Questions tagged as 'sql'

3
answers

Tables / Temporary content in the bank?

Situation I'm wanting to manage a process using the resources that database offer, as INSERT , UPDATE , DELETE . However, this process is temporary, that is, I have to generate tables and data that, once the connection is...
asked by 22.01.2016 / 11:48
2
answers

SQL function that applies to each column row

We work with multiple tables that contain a date field, sometimes we need to separate the date string into 3 columns (day / month / year). I have done a function where you pass the date string and it returns those 3 columns, but how do I return...
asked by 15.12.2014 / 20:03
2
answers

Is there performance gain when using View's in SQL?

The View 's are virtual tables, resulting from SQL queries, as in the example: CREATE VIEW view_name AS SELECT column_name(s) FROM table_name WHERE condition From this, we can update or delete a View , but we can not edi...
asked by 15.07.2014 / 17:57
3
answers

Find string in more than one SQL table

I would like to fetch a given string using LIKE in more than 1 table. Here is an example of how I did it, which will probably spend a lot of time or not fetch all tables: string SQL1 = @"SELECT * FROM TB_1 WHERE NOME LIKE '%' +...
asked by 06.03.2014 / 19:37
3
answers

Query in a SQL string in C #

I am doing a query in the database via string sql.append , in the method call I have two parameters, two strings these receive a textbox typed by the user and do the verification in the database. How do I concatenate correctly? Be...
asked by 11.04.2014 / 17:19
2
answers

What is considered when ordering a varchar field? Being filled by numbers

I have a table with the birthdays of the month, for a reason of use here we should store this as varchar . In the use of it it is necessary to sort by the date from the most recent to the oldest, it used this command: SELECT * FROM m...
asked by 07.05.2018 / 18:41
3
answers

Subtraction of multiple selects

I'm learning about SQL and I'm having a problem making certain calculations. I would like to subtract values from selects below. I've already tried to SUM ( A - B - C) , but to no avail. My code: (SELECT sum (dr.valortitulo)...
asked by 24.04.2014 / 14:53
1
answer

How to update fields with fields from another table?

I'm not able to update a table with the select of another. I have a mdl_user table that contains several columns and created another users_sg to copy some columns. I copied with INSERT INTO users_sg (id, username, firstna...
asked by 17.08.2016 / 16:03
1
answer

filter records per month

I have the following query: $sql= mysql_query("SELECT dia, GROUP_CONCAT(hora) FROM marcacoes WHERE colaborador_id = {$colaborador_id} GROUP BY dia "); Returns the following table: But I want it to appear only from month 6 for example...
asked by 26.07.2016 / 19:44
1
answer

Foreign key can be null in Entity?

I'm having a hard time on a project. I have created two tables ( Union and School ), with% of the Union table being PK in the School . But this FK can be null, meaning the School can belong to a Union or not. Well, here's...
asked by 30.07.2015 / 16:59