Questions tagged as 'sql'

1
answer

"Linked Server" with MySQL

DBMS: SQL SERVER 2014 + MySQL 5.5 What are the SELECT, INSERT, and UPDATE syntax instead of using the "OPENQUERY" function, when connecting through the SQL Server Linked Server, connecting to MySQL?     
asked by 06.06.2014 / 14:17
2
answers

ORA-00907: right parenthesis not found

Hello, I have just been working with oracle, and I'm having this problem in the query, it returns the error: ORA-00907: right parenthesis not found, it follows below: ("""select ordem.id,ordem.data_prog,ordem.rms, ordem.pkpk,...
asked by 03.01.2018 / 14:27
1
answer

Use NOT EXISTS in 2 subquerys

I tried to use NOT EXISTS , but it is bringing the results that do not exist in the tb_pedidoproduto table, I believe LIMIT is not working: SELECT produto.idproduto ,produto.nomeproduto ,produto.idcategoria...
asked by 27.12.2017 / 13:52
1
answer

Bypassing the primary key duplication error

Hello, I have the following script, .sql, to create a table and also create a trigger. SET client_encoding TO 'LATIN1'; CREATE OR REPLACE FUNCTION before_insert() RETURNS trigger AS ' DECLARE n integer; BEGIN IF tg_op = ''INSERT'...
asked by 19.01.2018 / 18:41
1
answer

Error: Mysql returns the following "Subquery return more than one row"

Good morning! I created this query in mysql and when I add the 1st subquery I called "totalEscolas" I get the following error: "Subquery return more than one row" without this subquery the code works blz. Could you help me? Thanks! SELECT...
asked by 24.11.2017 / 14:08
1
answer

What is the foreign key (SQL) [duplicate]

As I've been researching, when it comes to pulling information from two tables in a database, you use JOIN, which has nothing foreign key in it. So what's the use of declaring a field as a foreign key? I see no point. Can someone explain me...
asked by 01.11.2017 / 12:38
0
answers

Result interval

I have a table where records are saved every 3 seconds 24 hours a day Table: myTable dado1 dado2 dado3 data "135,05" "134,69" "135,10" "2018-11-13 15:38:16" "132,00" "131,91" "132,61" "2018-11-13 15:...
asked by 14.11.2018 / 19:15
2
answers

How to filter results and reload page / view in CodeIgniter?

I have code in CodeIgniter which takes a value of select dropbox in a view and leads to a second view showing the results in a table. In that second view , I kept the dropbox and the submit ("Filter") but...
asked by 17.03.2014 / 13:11
1
answer

compare and sum in sequence with sql server

I want to add the col3 fields by checking that the col2 value is the same as the following by doing a sequential group by. col1 col2 col3 ind seq1 5 ind seq1 3 ind seq1 7 ind seq1 4 ind seq2 5 ind seq3 1 ind seq3 3 ind se...
asked by 17.03.2017 / 19:32
2
answers

SQL: Doubt in Relationship between Tables

I'm creating an academic system that consists of a virtual restaurant menu type, so I've created three tables in the database: Menu Items Table: CREATE TABLE ITEMS( ID INT PRIMARY KEY NOT NULL, NOME VARCHAR(20) NOT NULL, DESCRIC...
asked by 05.09.2017 / 13:48