Questions tagged as 'sql'

1
answer

Query gets slow with ORDER BY

I have a problem, I have a query and when I use ORDER BY it gets very slow.    Note: I created an index for the premium field and another index for the score Follow the complete query: SELECT p.id AS id_freelancer, p.nom...
asked by 11.04.2014 / 22:35
1
answer

How to rename a constraint in mysql?

I created a primary key constraint in my table as follows: CONSTRAINT PK_user_type PRIMARY KEY(id) But now I need to rename it to: CONSTRAINT PK_type PRIMARY KEY(id) Based on this, I have the following questions: 1 - How...
asked by 10.10.2018 / 22:29
1
answer

Error in PDO query

I am creating a registration page where I have several tabs, according to the structure below: <div> Aba 1 </div> <div> Aba 2 </div> <div> Aba 3 </div> <div> Aba 4 </div> e assim vai... Inside...
asked by 04.02.2015 / 15:09
1
answer

How to select multiple columns using the table prefix only once?

In the relational model condition, I have to specify the table prefix, am I right? Example: SELECT c.nome, c.idade, a.nome, a.idade FROM ... What I wanted to know is if you can not do something like this: SELECT c(nome, idade)...
asked by 23.03.2017 / 20:59
8
answers

Why is "SELECT * FROM table" bad?

It is often said that getting all the columns of a table through the SELECT * FROM tabela command is bad practice. Any recommendations without explanation are not helpful. So ... If it is bad practice, there must be a way to use it pro...
asked by 16.06.2014 / 21:26
1
answer

Data Link in SQL

I really do not handle almost anything database and related, but I'm doing an "admin" system here for a client and wondered about the following point: I have two tables, one that saves the images themselves, with the link and everything els...
asked by 07.07.2015 / 19:59
1
answer

I can not display the value of SQL

I'm trying to start a MySQL database connection and it works, but when I request that PHP display what it has there nothing appears. It's as if the connection to the BD had failed. <?php // definições de host, database, usuário e senha $s...
asked by 25.12.2014 / 21:44
3
answers

How to make a left join using a where condition?

I have two tables: category -------- id | nome | imagem user_follow_category -------------------- id | from | to | date Note: The relationship of the two tables is given by category.id and user_follow_category.to . What I w...
asked by 27.01.2015 / 10:13
1
answer

How to filter a SELECT with n: m and bring all features?

I'm using n:m to create a system of attributes / characteristics for certain products, so I can reuse the same attributes for more than one product, the table looks something like: WhenIexecuteaSELECTlikethis:SELECTPROD.idASPRODUTO_ID,...
asked by 22.01.2015 / 23:33
2
answers

Place data from a row in columns

SELECT datacc, horacc FROM R070ACC WITH (NOLOCK) WHERE numcad = '2676' AND DATACC between ('2018-16-04') and ('2018-15-05') and oriacc = 'E' In the first column appears the day of the month repeated 4x, with different records in the sec...
asked by 16.06.2018 / 17:27