codingtcher.com
Theme Night
Home
Login

Sql Select

Home » Sql » Sql Select

SQL SELECT

SELECT first_name, last_name
FROM Customers;

SQL SELECT

SELECT name
  FROM country
  WHERE region = (
      SELECT region
      FROM country
      WHERE name = 'Brasilien'
      )

sql select

SELECT * FROM TABLE_NAME;

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;

sql select statement

SELECT column1, column2, ...
FROM table_name;

Sql Related Post