Tuesday, 9 June 2020

orderby

SELECT * FROM Customers
ORDER BY Country;
SELECT * FROM Customers
ORDER BY Country DESC;
SELECT * FROM Customers
The following SQL statement selects all customers from the "Customers" table, sorted by the "Country" and the "CustomerName" column. This means that it orders by Country, but if some rows have the same Country, it orders them by CustomerName:
ORDER BY Country, CustomerName;
If two roows has same country name , at that it sorts based on other column
SELECT * FROM Customers
ist it will aphabetically order in country, if two rows are matched, at that customer name in desccending only for matcged two country name
ORDER BY Country ASC, CustomerName DESC;



No comments:

Post a Comment