Questions tagged as 'sql'

2
answers

How can I change the format of a date in SQL Language?

I am working with the HR SQL database (ORACLE), and I would like to know how to change the date format Current format 06/17/03 Future or expected format June 17, 2003
asked by 08.03.2018 / 14:46
1
answer

final part of a QUERY

I am finishing a query that I have been asked but I can not finish it, the structure of the tables is as follows: child CREATE TABLE CHILD( child_id SMALLINT, child_name VARCHAR(255) NOT NULL, birth_date DATE NOT NULL, gender VARCHAR(255)...
asked by 30.10.2017 / 20:08
1
answer

derby search by join date

I must select the names of the clients whose service was made on 2012-07-15 SELECT nombre FROM Clientes c JOIN Servicios s WHERE s.Fecha = '2012-07-15'; but I get an error    [Exception, Error code 30,000, SQLState 42X01] Syntax error: E...
asked by 31.10.2017 / 20:41
1
answer

Verify the name of a varchar field and concatenate an int in case it already exists

I am reprogramming a calendar to save tasks to perform and I need a stored procedure that allows me to verify if the name of the task exists in the 'subject' column of my Appointments table, if it exists it must modify the name adding it at the...
asked by 11.08.2017 / 15:03
2
answers

Get several values in a query

I have this code: cursor.execute('SELECT nom FROM productes WHERE listacompra = 1') rows = cursor.fetchall() for row in rows: print(row[0]) In the SQL database, I have two rows with something like this: id 1, nom Custard, list purc...
asked by 06.09.2017 / 19:42
1
answer

Change database using variable @databaseNameVariable

How to change the database with the name of the base stored in variable ?; Do the following code, however, do not change the database. DECLARE @inicio VARCHAR (100) DECLARE @bdname VARCHAR (100) DECLARE @usedb VARCHAR (100) SET @inicio =...
asked by 21.08.2017 / 20:18
1
answer

SQL Query subquery level

I have a query that throws level error. It is a table that has the rates of change in two directions Example: moneda_from | moneda_to | tasa conversion ARS | USD | 0.20 USD | ARS | 20.00 I want to get one of the...
asked by 14.09.2018 / 02:18
3
answers

Do not do the date comparison [closed] well

I am doing a query where I know that my start date is '2017-06-12' and when I compare it I get that it is less than '2017-06-04' , what could it be? The query is as follows: select fecha_inicio ,month(fecha_inicio) as mes...
asked by 21.06.2017 / 00:03
1
answer

Export I leave without the name of the columns

I'm trying to export a table and I get it right but without the headers. Can you help me? This is what I have done so far declare @sql varchar(8000) select @sql = 'bcp "select * from Ana.dbo.detalle_incidencias" queryout C:\prueba.csv -c -t, -...
asked by 22.05.2017 / 10:39
1
answer

Take out an sql query

Hello, good morning and I look forward to your help. I need to get out of the table restaurant: and the table user: all those restaurants that do not belong to a user in this case is 3 (empty restaurant name), because as you...
asked by 20.05.2017 / 10:17