Questions tagged as 'sql'

1
answer

Query MySQL three tables

I'm trying to make an query in the MYSQL database, but the query is not coming back what I wanted. I want to make a query where I return all modules and modules that the company has with the where clause in Empresa_ID . MySQL Att...
asked by 08.06.2018 / 16:34
2
answers

How to Automatically Name a CONSTRAINT Manually Created in SQLServer 2016

Hello, I'm creating a database and I need to create some compound indexes to optimize the bank's processing. The problem is that I do not want to have to name those indexes one-by-one. Normally, I create a table as follows: CREATE TABLE Usua...
asked by 22.08.2018 / 17:53
1
answer

How to add primary SQL Server key?

Good morning! maybe it's simple my question, but ... I would like to know how to add primary key in a table not being at creation time (CREATE), I know that when accessing the table in "object explorer" in the "design" option it is possible with...
asked by 01.08.2018 / 14:10
1
answer

When is it valid to use XACT_ABORT () in a script that is already using TRY / CATCH?

Assuming the following code: /* DROP TABLE #Teste; CREATE TABLE #Teste(id INT); INSERT INTO #Teste VALUES(1); CREATE TABLE LogErros(id INT IDENTITY(1,1) PRIMARY KEY, nomeTransaction VARCHAR(100), errorMessage VARCHAR(500), horaErro DATETIME) D...
asked by 31.07.2018 / 14:40
1
answer

How to make a relationship between 5 tables?

I have the following tables: conteúdo , aulas , curso , turma , grupo_User where the logic will be as follows: A content can belong to several classes, as a lesson can have several contents A class can belong...
asked by 11.07.2018 / 19:36
1
answer

Dynamic Questionnaire php SQL Server

Hello,  I am building a calibration tool (given a checklist the user needs to select the fields that agree (or not) with a link or script. Ex.: 1)Colaborador inicia o atendimento conforme diretrizes. a) conforme b) não conforme c) não se apli...
asked by 20.07.2018 / 22:30
3
answers

MySQL printing multiple times

I'm having a problem printing the MySQL data in Eclipse. When I put to print the list of the registered data it is printing 3 times each information. I know where the problem is, but I can not see the solution. My database has a schema and...
asked by 24.07.2018 / 03:06
3
answers

SQL bring result with repeated numbers of column all only the largest

Hello, I'm trying to get a data but I'm not able to filter it the way I need it, for example: select a.cod, a.nome, b.pedido, b.versao from cliente a inner join pedido b On a.cod= b.cod order by b.pedido Now the problem one version has mor...
asked by 15.05.2018 / 22:59
1
answer

PLSQL displays error: PLS-00487: Invalid reference to variabel

I have a PLSQL code: in which I get two values one numeric and another varchar. Code: create or replace FUNCTION hospitalTeste123(MatriculaMedico in number, nomeSchema in varchar2 ) return varchar is type Tmedicos is record( matM...
asked by 14.05.2018 / 21:28
1
answer

(MySql) Insert or Update in the database

I need to perform a Insert in the database if there is no person's cpf. if it exists it has to do a Update . But all this through a single script in MySql . I have illustrated the example below as I am doing today: 1 If the cpf of the...
asked by 16.05.2018 / 03:39