Questions tagged as 'sql'

1
answer

Varchar or int for "type" fields

I have a type column with 6 options to save to the bank, is it best to save string as varchar or int and treat this in the front ? For example, when 1 is in the database, display certain string on the screen, and so on. I k...
asked by 17.10.2016 / 14:39
1
answer

Code to show procedures in MySQL [closed]

What is the code in MySQL to show the procedures created by me?     
asked by 10.10.2016 / 00:27
1
answer

Change sequence value with subselect

I have the following case: I need to change the value of a sequence according to the max (id) of the referring table, I am trying to do something like: ALTER SEQUENCE CFOP_SEQ INCREMENT BY (SELECT MAX(ID)+1 FROM CFOP); But it returns me the...
asked by 30.12.2016 / 11:42
1
answer

How to do select auto relationship N: N

I am not able to perform a SQL query with N: N relationship. I have a user table and one with user_has_usuario self-relationship, which will be registered responsible and students (from a school) would like to list the students by the CPF of the...
asked by 23.12.2016 / 20:22
1
answer

What is Associative Table?

Well, I see some examples of codes using associative tables. But I'm not sure what this term means, its applicability, concept etc ... What is an associative table?     
asked by 27.12.2016 / 20:30
2
answers

How do sql for a field in a non-primary table become foreign in another table?

CREATE TABLE PESSOA ( ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, CPF VARCHAR(15) NOT NULL, RG VARCHAR(10) NOT NULL, NOME VARCHAR(128) NOT NULL, DATA_NASCIMENTO DATE, PRIMARY KEY (ID) ) CREATE TABLE CADASTRO (...
asked by 13.05.2016 / 21:01
1
answer

PHP problem with SQL INT

I am making a form that sends the data by AJAX and then inserts, so far so good. Only the maximum value of INT in SQL is 2147483647, and the field I have has a maximum of 11 digits that can go up to 99999999999, what is the...
asked by 12.05.2016 / 12:28
3
answers

Problem in query with Between in MySQL?

In an input and output control system there is a cad_entrada_saida table where you have two columns in the dEntrada and dSaida database, these two columns are as varchar , and writing the data in the format dd/mm/yy...
asked by 03.05.2017 / 04:54
1
answer

Use of% in variables

I can not understand what this symbol is for in a variable, I see its use in some points in SQL code, Shell Script, C. What is the use? For example a use of this symbol in Shel Script: DATA=$(date +%H) The variable DATA receives t...
asked by 14.05.2017 / 18:54
1
answer

Sql Server - View the structure of View

I ran the following commands on the Sql Server database: comando 1: SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'vendas' resultado 1: TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ---------------- ---------...
asked by 17.05.2017 / 17:06