Questions tagged [SQL] (4020)

1
answer

How to convert the query in the sql file to json?

Good afternoon. Is the request file to the SQL database in sql format. How to convert this file in json format? PS. I tried to use online converters, but they give me error type: near "PROCEDURE": syntax error Thank you.
rory_Maye asked April 4th 20 at 14:21
1
answer

Offset does not work with subqueries?

Use Postgres, with pagination by using offset and limit, and using subqueries with the increasing number of offset greatly increases run time. I understand it first calculates for the entire table subselect, and then only makes a sample? Sort and conditions in the request does not
faustino.Reinger asked April 4th 20 at 14:18
3
answers

How to check values in the database?

There is a table in the database which recorded the user_id and username of the user. How to make so that the user data were recorded 1 time? id_proverka_bd = cur.execute("SELECT user_id FROM users where user_log = '%s'" %user_logg) if id_idd != id_proverka_bd: cur.execute("INSERT INTO users(user_id,user_log) VALUES (%s,...
birdie_OConnell asked April 4th 20 at 14:15
0
answer

How to choose data that meet two time intervals with the group?

There are two tables: user - user_id comment - ... - created_at // Y-m-d H:i:s - is_shown tinyint - user_id How to display users who have in the past three days was less than three comments from a symptom is_shown = 1, but for all time, there were more than 3? This has to be one request.
Brielle.Bernhard asked April 4th 20 at 14:13
4
answers

Literature on quick start to SQL for the beginner in middle(Gojny, subqueries, max, AVG, etc.)?

Hello everyone! At the time the SCR is not particularly needed, missing on a very basic level - select with where clauses, ordery by, like, between, distinct) Right now there is great need to make a tangible breakthrough in SKL, at least said explore joini, subqueries, functions max, rownum and so on... Especially before th...
Kamron_Sauer asked April 4th 20 at 14:01
1
answer

How to copy rows from tables in the same table updating only one column?

Good afternoon. There was a need to create a copy about a dozen rows in the same table leaving the same values except for one column building_id where you need to change the value of c 138 to 655. In table 12 columns. How to make such a request? Is it possible to do it without listing each column?
Ladarius_Gorczany asked April 4th 20 at 13:58
2
answers

To pass a parameter to output from the database[PHP,SQL]?

Hello there! Learn PHP and write a small project more for of purchase practices. The question how to show the page output, only the desired record with a unique identifier? The table schema pages: id, name, content, author, date Table id each time new and unique. The main page to display all records:index.php.... $sth = $...
nona.OReilly asked April 4th 20 at 13:53
2
answers

The problem of withdrawal from the database(php,pdo)?

Hey guys! Actually have a DB table with content type which is text. In this tabletize content is the data of the form tag code() if you remove the tags, or insert something like a plain text - "lalalala", then everything is displayed, otherwise - white screen. The PHP file that outputs entry: ... $sth = $dbh->prepare("SE...
savanna.Hills asked April 4th 20 at 13:53
1
answer

As tagounit the table and find a connection?

There is a table of the format: SELECT '1'as a,'3'as b, '5' as c UNION SELECT "as a,'3'as b, '5' as c UNION SELECT '6'as a,"as b, '7' as c UNION SELECT '6'as a,'3'as b," as c UNION SELECT '99'as a,'39'as b," as c UNION SELECT '99'as a,"as b, '98' as c;+----+----+----+ | a | b | c | +----+----+----+ | 1 | 3 | 5 | | | 3 | 5...
Haley_Eichmann asked April 4th 20 at 13:48
2
answers

How to make the most optimal query with search by same field in different PostgreSQL tables with sorting it in the end result?

Database PostgreSQL 9+ There are several tables of different entities, they have some identical fields (name, price, description,...). They are across the table is a bunch combined into one list for display on a screen. This table looks like this:CREATE TABLE section_items( id serial not null primary key, section_id int4...
hilario.Jaskolski asked April 4th 20 at 13:43