0% found this document useful (0 votes)
3 views3 pages

Notes 1

Uploaded by

xehad13913
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Notes 1

Uploaded by

xehad13913
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

SQL - Structured Query Language

Why do we use SQL ?

Big data is stored in a database. To interact with the data in the database, we need a language - SQL

4 Tasks that we can perform with SQL - CRUD Tasks

- C - Creating new data in the database


- R - Reading the existing data from the database
- U - Updating the data in the database
- D - Deleting the data from the database

Lesson 1

https://sqlbolt.com/lesson/select_queries_introduction

select title from movies ;

select director from movies ;

select title, director from movies ;

select title, year from movies ;

select * from movies ; (* is a shortcut in SQL, which means select all the column)

Lesson 2

https://sqlbolt.com/lesson/select_queries_with_constraints

SELECT * FROM movies


where id = 6 ;

SELECT * FROM movies


where year between 2000 and 2010 ;

SELECT * FROM movies


where year not between 2000 and 2010 ;

SELECT * FROM movies


limit 5 ;
Lesson 3

https://sqlbolt.com/lesson/select_queries_with_constraints_pt_2

SELECT * FROM movies


where title like "Toy Story%" ;

SELECT * FROM movies


where director = "John Lasseter" ;

SELECT * FROM movies


where director is not "John Lasseter" ;

SELECT * FROM movies


where title like "WALL%" ;

Lesson 4

https://sqlbolt.com/lesson/filtering_sorting_query_results

SELECT distinct director FROM movies


order by director asc ;

SELECT * from movies


order by year desc
limit 4 ;

SELECT * from movies


order by title asc
limit 5 ;

SELECT * from movies


order by title asc
limit 5 offset 5 ;

Lesson 5

https://sqlbolt.com/lesson/select_queries_review

SELECT * FROM north_american_cities


where country = "Canada" ;
SELECT * from north_american_cities
where country = "Mexico"
order by population desc
limit 2 ;

SELECT * from north_american_cities


where country = "United States"
order by population desc
limit 2 offset 2 ;

You might also like