To recap, SQL or Structured Query Language 0:00
is a specialized language to getinformation or data out of a database. 0:04
There are many differentdatabase systems such as MySQL, 0:09
Microsoft SQL Server, Oracle,PostgreSQL, and SQLite. 0:13
All of them use the same language, SQL. 0:18
Just like spoken languages, programminglanguages have their own vocabulary and 0:21
grammatical structure. 0:25
Programmers refer to this vocabulary andgrammar as syntax. 0:27
Thankfully, most programming languageshave a much smaller vocabulary 0:30
than spoken languages. 0:34
Though they are few, 0:36
the vocabulary words in programminglanguages are very important. 0:37
And we call them key words. 0:41
[SOUND] A keyword is a command that youissue to a computer to do a certain thing. 0:42
And SQL has its own sets of keywords. 0:48
Lines of SQL code are knownas a Statement or a Query. 0:51
A statement in SQL is likea sentence in English. 0:56
A query in SQL is like askinga question in English. 0:59
Most queries, no matter how complex,are issued to the database one at a time. 1:03
You may hear the issuing of a statementbeing referred to as running a query, or 1:09
executing the SQL. 1:14
Let's take a look at a common SQL query. 1:16
We'll retrieve all information fromthe table with the data about books. 1:19
Remember, a table is one ofthe spreadsheet like structures 1:24
inside a database made up of rows andcolumns. 1:27
Let's see how we might writea query in English first. 1:31
[SOUND] What is all the information wehave about each book in the books table? 1:36
Now, let's see the SQL syntax tobring back all the information from 1:41
the books table. 1:44
See those upper case words there,SELECT and FROM? 1:45
They are key words or special wordsreserved for the SQL programming language. 1:48
You issue a select command whenyou want to write a query. 1:54
You're asking the database to select or 1:58
retrieve some of the informationfrom a particular table. 2:00
In this case, it's books. 2:04
The asterisk, or the star character,means you want to bring 2:06
all of the information in allof the tables' columns back. 2:09
I'll show you how to bring backspecific columns of information later. 2:13
The semicolon at the end ofthe query is like a period or 2:17
a question mark at the endof a sentence or question. 2:21
The semicolon lets the database knowwhere the statement ends or terminates. 2:24
When we issue the statementto the database, 2:29
you can expect all entries inthe books table to be returned. 2:31
Let's see the results of thisquery in the SQL playground and 2:35
see this query in action. 2:39
As you can see, it brings back allinformation in the books table. 2:42
Let's ask another question. 2:46
Who are all the users ofthe library in the patrons table? 2:48
We'd use the SELECT keyword, 2:52
star, meaning all of the columns, 2:55
FROM, and then the table name. 2:58
In this case, the table name is patrons. 3:00
Don't forget the semicolonto terminate the statement. 3:04
Once we execute this query,it will return all patron information. 3:07
So generally speaking,writing SELECT * FROM <table name>; 3:12
is a query we can use toretrieve all data from any table. 3:17
This can be useful for small data sets. 3:22
When you have larger data sets likethe users of a large social network, or 3:25
the orders from a popular e-commerce site,you probably don't want to run queries 3:30
like this because it can take a very longtime to execute and return the results. 3:35
This can slow the performance down forother database users too. 3:40
However, the data sets in thiscourse are very small, and 3:44
running these types of queries won'thave any real performance impact. 3:48
Databases have more utility than reportingall the information in one table. 3:52
In the next video, I'll show youhow to bring back specific columns. 3:57