Questions tagged as 'sql'

1
answer

mysql Rank grouped function for a COUNT

I have 3 tables in MYSQL represented here as an example: IneedaquerythatreturnsaRANKofcontractsexecutedgroupedbycommercialinagivenperiodoftime,forexample:AquerythatreturnstheRANKofthecommercialsbetween2016-01-01and2016-01-03,shouldlookliketh...
asked by 04.12.2016 / 17:50
1
answer

Summaries and db Reformatting for a DataGridView

Probably did not elaborate a correct title, but I will try to explain my detailed question. I'm working with WindowsForm in VisualBasic15 I need to make a form where I can get data from tb to db . But I do not just want to...
asked by 01.02.2017 / 14:58
2
answers

How to find the second largest number

I need to get the photo with the second highest salary <?php $host = "localhost"; $username = "root"; $password = ""; $db = "imagem"; mysql_connect($host,$username,$password) or die("Impossível conectar ao banco.");...
asked by 31.01.2017 / 18:37
1
answer

Foreign Key Sql Server

I have a doubt refuse the foreign key in the following situation: Tehno the table UF, with 3 columns: ID_UF (PK), Cod_UF (int) and DescUF (nvarchar (50)) I have another table called IDE, with 3 columns: ID_IDE (PK), Cod_UF (int) and...
asked by 30.08.2016 / 17:07
1
answer

Relationship of two tables

Well, I have two tables and I need to relate them. I'm doing it this way: SELECT lancamentos .* FROM lancamentos INNER JOIN clientes ON lancamentos.cliente_id = clientes.id ORDER BY clientes.nome ASC But I need to bring the n...
asked by 30.08.2016 / 22:05
1
answer

Problem to insert into the database - SQL

Follow the code: Update command works: int noOfRowUpdated = ctx.Database.ExecuteSqlCommand("Update Mapa set Geo = geography::Point(47.65100, -122.34900, 4326) where Id= 1"); What does not work is insert command: int noOfRowInserted = c...
asked by 07.01.2017 / 04:55
1
answer

Doubt about data type database

Look at this table of INT data types in SQL SERVER: tinyint | 0 a 255 | 1 byte smallint |-2^15 (-32.768) a 2^15-1 (32.767) | 2 bytes int |-2^31 (-2.147.483.648) a 2^31-1 (2.147.483.647...
asked by 19.05.2017 / 17:01
1
answer

I want to use sql web but I am not able to create table or insert information in it

let db = openDatabase('produto_teste','1.0','banco de dados para cadastro do produto',2*1024*1024); db.transaction(function(tx){ tx.executeSql('CREATE TABLE IF NOT referencia(\ id INTEGER NOT NULL AUTOINCREMENT,\ nome VARCHAR NOT NULL,\...
asked by 19.05.2017 / 15:56
2
answers

Find frequency in MySQL tables

Here is my doubt. The system (PHP) has 6 identical tables (MySQL) that are the participations of users in certain events. Each entry in the table is unique but the data can be repeated in the tables. What I am not able to do is to search in thos...
asked by 24.11.2016 / 15:47
2
answers

How to show the result of one query based on the result of another?

Query A: SELECT V.CHAPA AS CHAPA, F.NOME AS NOME, V.DATA AS DATA, DATEDIFF(mi, MIN(BATIDA), MAX(BATIDA)) AS DIFF FROM V_BATIDASANTIGAS AS V LEFT JOIN V_DADOSFUNC AS F ON V.CHAPA = F.CHAPA WHERE V.BATIDA IS NOT NULL...
asked by 19.10.2016 / 18:10