Questions tagged as 'sql'

1
answer

Relationship table query N: N

How do I display all projects that have a specific advisor? The relationship between Advisor and Project is N:N , so it contains the Projeto_has_Orientador table as the relationship table. Tables: CREATE TABLE IF NOT EXISTS...
asked by 10.10.2015 / 05:41
2
answers

SELECT sort by quantity of another SELECT

I have two tables in MYSQL: account: id apelido_usuario 1 caio 2 manoel 3 josé product idconta status 1 3 1 3 1 1 2 3 3 2 I made a SELECT like this: SELECT * FROM conta WHERE apelido_usuar...
asked by 21.09.2015 / 20:00
1
answer

How to generate a record for each new relationship between two entities

Considering a scenario where a member has a account , personal profile , academic profile status (between pre-defined statuses: teacher, student and collaborator) within the system. For each status , the academic profile is different....
asked by 17.09.2015 / 13:49
1
answer

MYSQL - FK ERROR

Hi, could you help me? I am trying to add the FK in the table officials, only it is giving this error OBS I am creating the other tables before the officials 20:29:15 CREATE TABLE Funcionarios( id INT(5) NOT NULL AUTO_INCREMENT, nomeComplet...
asked by 13.09.2015 / 01:03
1
answer

Problem When printing a SQL query on the PHP page

I have a SQl query and my code is printed only the first line of the query, does anyone have any idea what my problem might be?    ERROR: Warning: mysql_fetch_assoc () expects parameter 1 to be resource, <?php include ("conexao.php...
asked by 16.10.2015 / 22:39
1
answer

How do I connect to the database via [WordPress] to consult?

Well, I have a call jQuery Ajax on header.php of my theme that is entering a PHP file in the root of my Wordpress and returning me echo test. I need this file to query the banco de dados and return me so...
asked by 29.07.2015 / 22:48
3
answers

SQL CASE with more than one condition

I wonder if you can use CASE with more than 1 condition. In this query I have calculations that need to be done when a.operacao == 'C' but that depend on the value of a.DESCRICAO_PREMIO ( '1P' or '1/5P' ) to...
asked by 08.05.2016 / 22:13
1
answer

Insert a large volume of data in the sql server

I downloaded a list of cities on the internet. There are more than 5,000 municipalities. I tried a simple Insert and I could not. You have exceeded the maximum number of 1000 records. Then I tried Bulk, but I do not know if I did it right or not...
asked by 06.05.2016 / 20:30
1
answer

How to do select picking the record that has the maximum value of a field?

I'm doing a select that is looking for records that meet certain conditions and then you should get only the record that has the maximum value of a given field. You're like this: SELECT VP.VAL_PREVISTO FROM TB_META M INNER JOIN...
asked by 31.07.2015 / 15:28
1
answer

Error adding "0" to a tinyint (1) field in the database

In my database in the users table, I have a field called status, whose type is tinyint (1). If the status is "0" the user is activated (can access the site), if the status is "1", disabled. But when doing an INSERT and set the status="0" of the...
asked by 03.08.2017 / 00:38