Course Content
Introduction to SQL
1. Retrieving Data
2. Sorting Retrieved Data
4. Advanced Data Filtering
Introduction to SQL
Retrieving Individual Columns
What is SQL?
SQL is a programming language for user interaction with databases, used to query, update, and manage databases.
Database
A database is an organized structure designed to store, modify, and process large amounts of data.
Let’s get started! In this course, we will work with a country
database containing a country
table. Let's look at this table.
id | name | continent | region | surfacearea | capital | population |
---|---|---|---|---|---|---|
1 | Japan | Asia | Eastern Asia | 377829 | Tokyo | 126714000 |
2 | Latvia | Europe | NULL | 64589 | Riga | 2424200 |
3 | Mexico | North America | Central America | 1958201 | Mexico City | 98881000 |
4 | Netherlands | Europe | Western Europe | 41526 | Amsterdam | 15864000 |
5 | Portugal | Europe | Southern Europe | 91982 | Lisbon | 9997600 |
6 | Sweden | Europe | Nordic Countries | 449964 | Stockholm | NUll |
7 | Ukraine | Europe | Eastern Europe | 603700 | Kyiv | 50456000 |
8 | United States | North America | NULL | 9363520 | Washington | 278357000 |
9 | Thailand | Asia | NULL | 513115 | Bangkok | 61399000 |
10 | Paraguay | South America | North America | 406752 | Asunción | 5496000 |
11 | Philippines | Asia | Southeas Asia | 300000 | Manila | 75967000 |
12 | New Zealand | Oceania | Australia and New Zealand | 270534 | Wellington | 18886000 |
13 | Norway | Europe | Nordic Countries | 323877 | Oslo | 4478500 |
14 | Monaco | Europe | Western Europe | 1.50 | Monaco | NUll |
15 | Malta | Europe | Southern Europe | 316 | Valletta | 380200 |
SELECT
is an operator in the SQL language that retrieves a data set (sample) from the database. To use the SELECT operator effectively, we need to specify exactly what we want to select and where we want to select it from.
In our previous query, we utilized the SELECT
to retrieve a single continent column from the country table.
It's important to note that you must specify the column name immediately after the SELECT
keyword, and the FROM
keyword specifies the name of the table from which we wish to retrieve data.
Task
Now, let's retrieve a capital
column from the country
table.
Once you've completed this task, click the button below the code to check your solution.
Everything was clear?