Questions tagged as 'sql'

2
answers

Foreign SQL key

I have two tables in SQL and I need to perform a search. The tables and fields are: Employees: 'code' and 'EmployeeName' Team: 'CodeEquipe' and 'RegisteredEngine', where 'RegisteredEngine' is linked to the 'Code' of the Employees table; Th...
asked by 20.11.2018 / 23:57
1
answer

How to only bring records that have no association in the second table?

I have a query that returns the number of phones registered in each state, country and also brings the number of clients that do not have a telephone number registered in each state, but parents would like to bring only those clients that do not...
asked by 22.09.2014 / 21:06
2
answers

Modifying Update Between Two Oracle Tables

I need to do an integration between two sws in the house and I need help. I have an integration table (3rd) that will receive the data of a new management, if it is created or modified. For this, I have a view that brings the source data a...
asked by 04.06.2014 / 03:20
2
answers

Handling dates for searching the bank

I am performing the following capture of a date: $dtInicial = $this->_getParam('dataInicial'); // Padrão dd/mm/aaaa To search the precise database, leave it in the yyyy / mm / dd pattern: $dt1 = date('Y-m-d', strtotime($dtInicial));...
asked by 12.12.2014 / 14:57
1
answer

Change ZIP Code column inserting hyphen character in Firebird

I have a table of cities where I have zip codes. The data looks like this: 89620000 I would like to leave them like this: 89620-000 How can I do this in Firebird?     
asked by 20.12.2014 / 02:08
1
answer

Always include records from another table if the value of the related field is not NULL

I'm doing a query query, based on a table. In this table (tableA) I bring several records from other tables, with some codes but one in particular is giving me a certain headache. There is a record in tableA that can be NULL and in this ca...
asked by 09.12.2014 / 19:59
1
answer

SELECT to fill a field

Good afternoon, I have a table called Pessoa and another Matricula , I need to make a query that returns the fields name , enrollment and seq_people , where name and seq_people are in the Pessoa table and matricula in...
asked by 07.11.2018 / 20:03
1
answer

How to create a 1: N and 1: 1 relationship within the same table?

I have a table for image registration that is used as foreign key for other tables. The problem is that in one of these tables (PROMOCOES) the ratio is 1: N (a promotion for N images), while in the other tables the ratio is 1: 1. My question is...
asked by 19.07.2014 / 17:04
1
answer

Mysql alter table command, difference of "modify" and "change"?

What are the main differences in change and modify, in which cases should I use them? alter table cadastro change nome nome varchar(20); alter table cadastro modify nome varchar(30);     
asked by 06.10.2018 / 02:23
1
answer

Column ambiguous

I have a code problem that I can not understand. The postgres always points to the error _ "column reference" pro_codigo "is ambiguous" _, however I gave the "nicknames" the column pro_codigo . I can not see the meaning. SELECT DISTINC...
asked by 09.10.2018 / 19:17