Questions tagged as 'sql'

3
answers

What is SQL injection and how can I avoid it?

I have found many questions in StackOverflow about web programs or forms that store information in a database (especially in PHP and MySQL) and that contain serious security problems related mainly to the SQL injection . Normally I leave a c...
asked by 20.05.2016 / 06:13
4
answers

Table relationships in MySQL

I have a big question about relationships in mysql. You see, I'm creating a site that looks like an e-commerce, it's for a colleague. I'm creating a table called categories and another one called subcategories . In the table subcategories...
asked by 19.07.2017 / 20:49
2
answers

Primary Key formats

I have some doubts that I would like to clarify, I have had bosses who have never wanted to work with ID Identity created by the same database manager, for the following reason that the correlative is lost. In my opinion the ID is not shown to t...
asked by 03.04.2016 / 04:20
5
answers

Difference in performance when consulting with SELECT DISTINCT and GROUP BY?

I'm reviewing and learning SQL, there's something I notice that I find curious. Suppose I have a table called productos and one of its fields is categoria , when I make the following queries I see that the result is the same: S...
asked by 20.01.2016 / 21:15
6
answers

MySQL - Use of AND & OR in the same query

I have a table like this one, which has two rows: nombre_per | apellido_per | permisos_busqueda_per -------------+----------------+---------------------- Mattew | Janeey | SI Janny | Pineda | NO My query is...
asked by 17.06.2016 / 13:55
3
answers

How to verify if two data intervals have shared elements?

A few days ago I saw a question that among other things implied a problem similar to the one I am going to raise, I wanted to do it in a more general way, because I understand that the well-thought-out solution could serve as a reference to simi...
asked by 03.08.2017 / 04:55
1
answer

Execute subqueries in materialized view

Query. The following is a query that uses three tables: (Everything from here on is anonymous, some involuntary error can slip) SELECT id ,id_dependencia ,descripcion_corta NOMBRE ,to_char(fecha_fallecimiento, 'YYYY-MM-DD') FE...
asked by 29.06.2017 / 19:23
3
answers

filter query with LIKE

I have to make a query to a database where I have a table of the data of people (name, address, colony, age, city, etc.) I want to obtain the addresses that necessarily have numbers, since I have some addresses where only the name of the street...
asked by 06.06.2016 / 20:07
1
answer

multiple sums in the same table

I have the following problem, I have 1 table in mysql where I have the information of people who have a debt from a clothing store for several years, what I want is a query that gives me the name of the person and that adds up your debt. Exam...
asked by 03.06.2016 / 22:32
3
answers

Difference between table variable and temporary table in SQL Server

Apparently, there are two ways to create a temporary table in SQL-Server: With a table variable ( table variable ) DECLARE @tmp TABLE (Col1 INT, Col2 INT) or with a temporary table ( temporary table ) CREATE TABLE #tmp (Col1 INT, Col2...
asked by 03.12.2015 / 17:23