Introduction to the SQL Database Query
See a sample chapter from latest edition of Sams Teach Yourself SQL in 24 Hours, 6th Edition Summarizing Data Results from a Query in SQL.
In this seventh hour, you will learn about database queries, which involve the use of the SELECT statement. The SELECT statement is the most frequently used of all SQL commands after a database's establishment. The SELECT statement allows you to view data that is stored in the database.
The highlights of this hour include
What a database query is
How to use the SELECT statement
Adding conditions to queries using the WHERE clause
Using column aliases
Selecting data from another user's table
What Is a Query?
A query is an inquiry into the database using the SELECT statement. A query is used to extract data from the database in a readable format according to the user's request. For instance, if you have an employee table, you might issue a SQL statement that returns the employee who is paid the most. This request to the database for usable employee information is a typical query that can be performed in a relational database.