Questions tagged as 'sql'

1
answer

Varchar as Primary Key

Hello I made a database based on a project I found on the Internet to do a REST.   The problem I have is that the Primary Key is type varchar and I can not auto-increment it since Mysql will not let me. I have to do the manual insertion....
asked by 29.01.2018 / 17:30
1
answer

How to create relationships between SQL tables

There are different ways to create a relationship in the tables, which is to make use of the Foreign Key (FK), I have these understood ways of doing it: 1) In the case of the creation of FK by SQL code ... to create a serious FK: FOREI...
asked by 08.07.2017 / 06:37
1
answer

Thousand separator in php or mysql

I have a query where it shows the numerical values with thousand separator (1,500) and I have two problems: When I open the modal window to edit the values it shows me the values with the thousand separator, but if I edit the value of one f...
asked by 10.07.2017 / 04:03
1
answer

Automate Oracle SQL Developer script

I would like to know if it is possible to automate a script in the Oracle database manager. What happens is that I have to run 3 lines or queries, every day. And I would like to know if there is a way to make automated. The queries are 3 s...
asked by 03.01.2017 / 18:05
2
answers

Reverse rows to columns with SQL

I need to make a select that shows rows as columns from a table, using the SQL language ie - Table DESC | ENERO | MARZO | JUNIO A | 80 | 73 | 84 B | 100 | 100 | 100 What I need is that you show me the query DESC |...
asked by 07.12.2016 / 16:44
2
answers

Mens. INSERT SQL error

I have configured a user with INSERT permission for Customers table: GRANT INSERT ON CLIENTS TO userX executing the query: return the following notice: Mens. 102, Level 15, State 1, Line 1 Incorrect syntax near ')'. (1 affecte...
asked by 29.08.2016 / 15:57
2
answers

Get fields related to the SQL query not added

Given the query: SELECT MAX(fecha), estado FROM tabla GROUP BY estado I get the maximum date of the table for each state. My question is: Can I get the columns that are not in the Group By without making aggregations? that is: SELECT M...
asked by 12.08.2016 / 09:13
3
answers

How do I prevent a "patient" from registering twice? PHP MySQL

I am creating a small "site" for a medical friend, who needs to keep track of patients, he needs to enter the data for each client as Full Name and Address, but I want to register a new patient, check if he is already is registered, taking into...
asked by 27.02.2017 / 06:04
3
answers

Query To know if a table field exists or does not exist in PostgreSQL

I can not find the way to do the query to create a field in a table and a foreign key in a PostgreSQL database, but previously verifying that it does not exist. In SQL server I use the following but they do not work in PostgreSQL 9.1. --- para...
asked by 08.09.2016 / 22:26
1
answer

Convert SQL with group by a LINQ

I am starting in the linq world, I would like to convert the following SQL query to linq. It's a bit complex and that's why I get lost. select T_Empresas.* , T_EmpresasIndicadoresK.* from dbo.T_Empresas, T_EmpresasIndicadoresK, (sele...
asked by 17.08.2016 / 14:55