SQL answers

  • 0answers
    Error with SQL when starting a bot in telegram - how to solve?
    Why in the column 'status' if I put the values: status BOOLEAN NOT NULL DEFAULT (TRUE) then when starting the telegram does not respond to the commands '/ subscribe', '/ unsubscibe' Tabular status '1' In the console ...
    SQL Anonymous, Sep 17, 2020

  • 0answers
    Error with telegram bot and sqlite3 - why can't it find the table?
    The database with the subscriptions table was created, but when you run the / subscribe or / unsubscribe command in the console: spoiler sqlite3.OperationalError: no such table: subscriptionsERROR:asyncio:Task exception was never retrievedfuture: <Task finished name='Task-136' ...
    SQL Reese Beasley, Feb 26, 2020

  • 0answers
    How to properly collect php request to display content by id?
    There are 2 columns in the base: site_category and site_news The site_category contains categories I created and recorded by the type: The category column contains entries of this type: name -> Химияcategory_id -> 1------------------------name - > Физикаcategory_id -> ...
    SQL Connor Andrade, Dec 31, 2019

  • 0answers
    How to write an SQL query for grouping?
    The console swears at the design. SELECT trips_amount, COUNT (company_name) AS cnt FROM cabs, trips GROUP BY trips_amount; Error in console - ERROR: aggregate functions are not allowed in GROUP BY I also tried to do the construction like this - SELECT COUNT (company_name) AS trips_amount ...
    SQL Layla Tucker, Oct 16, 2019

  • 0answers
    How do I write a valid SQL query with a CASE clause?
    Query construct - SELECT ts CASE description WHEN 'bad' THEN 'rain, storm' ELSE 'good' END weather_conditions FROM weather_records; The terminal swears at such a request. in the task, you need to isolate the data for each hour and divide the data into bad and good.
    SQL Anonymous, Mar 1, 2019

  • 0answers
    Joyne 3 sql tables, how?
    Hello everyone, I can't finish the request, help! You need to select all customer ids that meet the requirements: - city: both Samara and Barcelona - country: not England - sales & gt; 1500 - if times (frequency of visits) is more than 2, then the discount is 10%, the rest 5% Table 1 id ...
    SQL Landen McCoy, Oct 20, 2019

  • 0answers
    What are the ways to optimize sum counting on big data?
    I have a request, its essence is to simply sum up the data, according to the specified conditions. Data to count over 5 mil records. The selection conditions are different, for example: - sample by gender - sample by age - sample by region If you create a materialization_view, then ...
    SQL Anonymous, Feb 12, 2020

  • 0answers
    How to choose the active price and the previous one?
    Given: table with prices for goods: id - product identifier active_from - start date of price activity. active_to - the term until which the price is valid (may be null, then it is considered indefinite) price - price it is required to query to pull out the prices of goods for a specific date ...
    SQL Anonymous, Dec 17, 2020

  • 0answers
    How do I make a request with entries?
    There are three tables: "cakes", "products", "links". They include the following fields: cakes - cake id, cake name, quantity products - product id, product name, quantity links - id, cake id, product id The link table displays which products are included in which cake, the number of products ...
    SQL Anonymous, Jun 2, 2020

  • 0answers
    How do I write a SQL query?
    I have a task: the user indicates the name of the culture; on the basis of this data, deduce all varieties of the specified crop that did not complete the tests in the flow year. When filling out the base, I put each variety a test year from 2016 to 2019 and only a few in 2020. Each variety is ...
    SQL Anonymous, May 20, 2020

  • 0answers
    Is it possible in SQL to remove characters after period?
    There is a price column. It contains the prices of goods. For example: 564, 1220, 1999 - and there are such 444.3, 760.22, 990.12 Is it possible to remove everything after the dot using SQL?
    SQL Brielle Abbott, Oct 14, 2019

  • 0answers
    How from two pairs of values ​​found by a certain query, to get the associated values ​​from neighboring tables?
    Let's say I made some clever SELECT (inside of it there are also selects and all sorts of WHERE, GROUP, HAVING), which eventually brought me, say, two lines in two columns. All four of the resulting values ​​are id-shki. In the end, instead of these id-sheks, I need to get their names, ...
    SQL Elisabeth Patrick, Dec 7, 2019

  • 0answers
    How less expensive is pagination - from a common base or separate bases for heading categories?
    How to organize page-by-page navigation of headings less costly? For example, there is a database of 1,000,000 records from different categories. Page navigation forms lists from this base with a category condition. That is, every time it is calculated which records to take and reflect in ...
    SQL Clara Villanueva, Mar 18, 2019

  • 0answers
    Enumeration not working in ALL statement?
    Hello everyone, I am trying to get users who provide ALL services from an array: SELECT users.id FROM usersLEFT JOIN users_services ON users_services."userId" = users.id WHERE users_services."serviceId" = ALL(array[1,31]) But I can't do it, I get an empty result, although there is a user in ...
    SQL Blake Kane, Jan 28, 2019

  • 0answers
    How to make the multiplication table optimally?
    My option. SELECT @N:[email protected] + 1 AS '', (@N * 1) AS '1', (@N * 2) AS '2', (@N * 3) AS '3', (@N * 4) AS '4', (@N * 5) AS '5', (@N * 6) AS '6', (@N * 7) AS '7', (@N * 8) AS '8', (@N * 9) AS '9', (@N * 10) AS '10'FROM mysql.help_relation, (SELECT ...
    SQL Anonymous, Nov 16, 2020

  • 0answers
    Which command to display the city with the most animals?
    there is a table CREATE TABLE Zoo;INSERT INTO Zoo (`id`, `city`, `animals_id`)VALUES (1, 'Novosibirsk', '1'), (2, 'Moscow', '2'), (3, 'Novosibirsk', '3'), (4, 'Novosibirsk', '4'), (5, 'Tomsk', '5'); What team can do this?
    SQL Anonymous, Jun 2, 2020

  • 0answers
    How should a sql query from two tables (join) look like?
    display the title, description, and year of all books where the author is Roma
    SQL Caleb Castaneda, Jan 9, 2019

  • 0answers
    It is necessary to display the zalog.id by which overvallue.vallue and liquidity.name were changed, indicating the changes. How can I do that?
    It is necessary to display the id by which there were changes in the overvalue.value and liquidity.name fields and in a separate column what changes were made
    SQL Anonymous, Jul 6, 2020

  • 0answers
    Why does the second request work incorrectly when merging?
    Hello. request (Select c.id, Count (s.email) as kol1 From campaigns c Left Join subscribers s on c.id = s.campaigns_id And s.created_on between '2020-10-15' and '2020-11-01' group by c.id) union (Select c1.id, Count (cd.email) as kol2 From campaigns c1 Left Join ...
    SQL Addison West, May 28, 2019

  • 0answers
    Will I be able to do a database search?
    I have a database with 3 tables. Orders: Companies Clients I use JOIN to connect them SELECT * FROM `orders` LEFT JOIN companies ON orders.company_id=companies.id LEFT JOIN clients on orders.client_id=clients.id WHERE companies.id=clients.company_id This is displayed: This will ...
    SQL Michael McMillan, May 1, 2020