Questions tagged as 'sql'

1
answer

Rename All MySQL Database

I would like to know if it is possible to rename a whole database of MySQL I have the Database Register with the people table I would like to rename CAD_CRS Is it possible?     
asked by 12.07.2017 / 01:47
2
answers

Foreach in SQL to put a value in a variable

My problem is that I have a subquery that works perfectly, but for this I have to insert the id I want in the variables. In the @mediaKM_mes variable I select the tbl table by car id; in the @km variable I select the table tblCar by the car i...
asked by 11.07.2017 / 01:05
1
answer

Python Error SQLACHEMY

It is giving an error when I try to connect to the SQL SERVER database with SQLALCHEMY from sqlalchemy import create_engine, engine import pandas as pd engine = create_engine('mssql+pyodbc://User:password@server:1433/Bases_testes?drive=SQL+Ser...
asked by 28.10.2018 / 16:22
1
answer

INSERT with Random SELECT

I have a table with a lot of information and an empty one. I need to make an INSERT on this empty table with just one information from the other table, but SELECT must be random. I'm using the following line in VBA: db.Execute "INSERT IN...
asked by 30.09.2018 / 08:15
2
answers

Add FK to mysql table

I have already checked and engine and is like InnoDB, in code tbm I did not find error, I had already done the command in another table before then I'm a little lost about the cause, follows the codes of the tables:
asked by 03.10.2018 / 16:35
1
answer

When Calculating quantity greater and less than Average returns error in SQL SERVER

In Columns: SUM(CASE WHEN cqd.queuetime < AVG(cqd.queuetime) THEN 1 ELSE 0 END) as 'Qtde < Média' e SUM(CASE WHEN cqd.queuetime > AVG(cqd.queuetime) THEN 1 ELSE 0 END) as 'Qtde > Média', returns the following error in SQL SERVER...
asked by 30.11.2018 / 14:05
2
answers

Problem running SQL

Good afternoon. I have a simple query in SQL Select * from Tabela Order By Campo Where this field is a string, and this string has data such as "xyz001" , "xyz002" , "xyz0011" , so "xyz0011" is displayed first as...
asked by 12.09.2018 / 17:11
1
answer

Multiple SQL Query

I'm not very experienced with SQL language, how could I make a query work this way: SELECT *, ( SELECT marca.* FROM marca WHERE marca.id = produtos.id ) AS nome_marca FROM produtos WHERE id = 5 What I want to return is all * of table...
asked by 07.12.2018 / 19:51
1
answer

Different result between select, after applying SUM () and Grop By [closed]

I am making an elastix bind report and I have a problem here in the output. Theoretically, if I do not touch Where , the result would have to be the same. select distinct (case left( devices.id ,2) when '10' then 'SAC' when '40' then 'SA...
asked by 20.02.2014 / 20:13
1
answer

update nls_database_parameters Oracle

I need to change the parameters nls of Oracle, putting the characteristics of the image below: I've tested a lot of tips, but it always says I have insufficient privileges. These are my settings: NLS_LANGUAGE AMERICAN NLS...
asked by 18.09.2018 / 12:50