Lesson 1
Basic SQL Queries
You will need to use SQL statements to query and modify the database in the VirtualBookShelf.com Web site.
This module focuses on how to write some of the most basic queries. When you finish, you will be able to do the following:
- Use the SQL
SELECT
statement to retrieve all the rows in a table
- Modify a
SELECT
statement to parameterize data search criteria
- Sort, modify, add, and delete records in a table
SQL Query Designer Control for .NET
Later in the course, you will learn how to use the
SQL Query Designer Control for .NET to build advanced queries.
What is a database?
A database is one or more large structured sets of persistent data, usually associated with software to update and query the data.
A simple database might be a single file containing many records, each of which contains the same set of fields where each field is a certain fixed width. Breaking this definition down into something more manageable, first it says that a database consists of structured sets of data, which means that a database contains collections of data.
For example, the database might contain the details of relationaldbdesign or data about all the books in a library. You probably would not want to mix these two collections of data, or else when you want to find data about a book you would have to look through irrelevant data on golf scores.
In short, databases help you organize your data. A database stores its collections of data in tables.
The definition goes on to say that databases are usually associated with software that allows the data to be updated and queried.
Real-life examples of database software include Microsoft's Access, Oracle's 11g, IBM's DB2, MySQL, and Microsoft's SQL Server 2012. Often these programs are referred to as databases, but strictly speaking, they are database management systems (DBMS). A database is the sets (collections of related data) grouped into one entity.
You could, for example, create an Access database, call it MyDatabase, include various data collections inside that one database, and manage the whole thing with the MS Access software.
In the next lesson, SELECT
statements that retrieve all rows from a single table will be written.