“Declaración de selección de SQL” Código de respuesta

SQL SELECT

SELECT * FROM table_name;
-- Sorting col1 ASCending then col2 DESCending
SELECT col1, col2 FROM table_name ORDER BY col1 ASC, col2 DESC;
-- Filter on col1
SELECT col1, col2 FROM table_name WHERE col1 = 'a value';
-- Containing 'searched'
SELECT col1, col2 FROM table_name WHERE col1 LIKE '%searched%';
-- All different values
SELECT DISTINCT col1 FROM table_name;
-- Simple sum
SELECT col1, sum(col2) FROM table_name GROUP BY col1;
VasteMonde

SQL SELECT

SELECT * FROM products WHERE stock_count <= 10 ORDER BY stock_count ASC;
DevLorenzo

Columnas de devolución de la tabla SQL

SELECT *
FROM INFORMATION_SCHEMA.COLUMNS -- INFORMATION_SCHEMA is an ANSI-standard (American National Standard Institute) set of read-only views which provide information about all of the tables, views, columns, and procedures in a database
WHERE TABLE_NAME = N'Customers' -- "N" defines the subsequent string (the string after the N) as being in unicode
CodeHelper

SQL SELECT

SELECT * FROM TABLE_NAME;
Wicked Wolverine

declaraciones de selección de SQL

SELECT orders.order_id, customers.last_name
FROM orders
INNER JOIN customers
ON orders.customer_id = customers.customer_id
WHERE orders.order_id <> 1
ORDER BY orders.order_id;
Attractive Ape

Declaración de selección de SQL

Projection = Select the columns in
a table that are returned by a query
Selection = Selects the rows in a
table that are returned by a query
Join = Brings together data that is 
stored in different tables by
specifying the link between them
Obedient Ocelot

Respuestas similares a “Declaración de selección de SQL”

Preguntas similares a “Declaración de selección de SQL”

Más respuestas relacionadas con “Declaración de selección de SQL” en Sql

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código