/* 
This is a
multiline comment.
*/  
-- One line comment.


--SQL: Structured Query Language
-- - DDL: data definition language: create, alter, drop
-- - DML: data manupulation language: insert, update, delete
-- - Query language: select 
-- - DCL: data control language 
--  *transaction handling: commit, rollback, savepoint
--  * privilege handling: grant, revoke;

-- the semicolon (;) is not part of the statement
-- Run statement: ctrl+enter

--Use a SELECT statement or subquery to retrieve data from one or more
--tables.

--List all books from book_library
select *
from book_library.books;


--List the titles and prices from book_library 
select title, price
from book_library.books;

select first_name, last_name
from BOOK_LIBRARY.authors;

select first_name, last_name
from book_library.customers;


--Concatenation

--List the names of the customers. 

--Use the ORDER BY clause to specify the order in which cells on the left-hand
--side of the rule are to be evaluated.
--You can specify an ascending (asc or nothing) or a descending (desc) order.
--You can specify whether returned rows containing null values should appear
--first or last in the ordering sequence with NULLS FIRST or NULLS LAST
--clause.

--descending

--ascending

--List the books. Sort the list by number of pages ascending. Put the rows to the beggining --of the list where the number of pages is not given.
--nulls first 


--List the books. Sort the list by prices ascending. Put the rows to the end of the list where the prices is not given.
--nulls last 

-- The WHERE condition lets you restrict the rows selected to those that satisfy
--one or more conditions.


-- topic is History

-- price is less than 2000


--price is less or equal than 2000


--AND
--OR

--is null

--is not null