Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql order by multiple columns

SELECT * FROM table_name ORDER BY col1 ASC;				-- ASCending is default
SELECT * FROM table_name ORDER BY col1 DESC;			-- DESCending
SELECT * FROM table_name ORDER BY col1 DESC, col2;		-- col1 DESC then col2 ASC
Comment

multiple order by sql

SELECT * FROM People ORDER BY FirstName DESC, YearOfBirth ASC
Comment

sort order on two columns sql

Sort by multiple column : ORDER BY column1 DESC, column2
Comment

sql order by two columns

ORDER BY column1 DESC, column2
Comment

multiple order by sql

ORDER BY column1 DESC, column2
Comment

Order values on multiple columns SQL

-- the ORDER BY is used to sort results in order according to the values of one or more columns:
SELECT title, release_year
FROM films
ORDER BY release_year; -- Ascending (is default)
ORDER BY release_year DESC; -- Descending, add DESC
ORDER BY release_year, title; -- add comma to order on multiple columns
Comment

SQL ORDER BY With Multiple Columns

SELECT *
FROM Customers
ORDER BY first_name, age;
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql order by multiple columns 
Sql :: sql server create constraint 
Sql :: sql set 
Sql :: ERROR: syntax error at or near "AUTO_INCREMENT" posgtresql 
Sql :: oracle select into 
Sql :: sql replace single quote 
Sql :: mysql delete data in table 
Sql :: commit in sql 
Sql :: SQL: get date difference in minutes 
Sql :: T-SQL - Delete Column 
Sql :: update sqlite 
Sql :: sql database connectivity 
Sql :: what is datetime in sql server 
Sql :: how to view created temporary tables in mysql 
Sql :: list table columns mysql 
Sql :: SQL Duplicates by Composite 
Sql :: sql in 
Sql :: mysql count table rows 
Sql :: mysql show create table 
Sql :: create table with timestamp postgresql 
Sql :: psql no such file or directory 
Sql :: image for MSSQL Windows Docker 
Sql :: add foreign key to existing table postgres 
Sql :: import mysql database command line linux 
Sql :: SQL select example 
Sql :: json_value oracle 
Sql :: pgadmin see indexes 
Sql :: dbms_metadata.get_ddl table 
Sql :: sql unique constraint 
Sql :: sql remove check constraint 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =