Table and Query

BY IN ITGS - Database & Spreadsheet Comments Off on Table and Query

Database tables will most likely be the area you’ll become most familiar with after working with databases for a while. Now, before we go ahead and start adding tables to our new database, let’s have a look at what a database table actually is.

What is a Table?

In database terms, a table is responsible for storing data in the database. Database tables consist of rows and columns .

Queries are one of the things that make databases so powerful. A “query” refers to the action of retrieving data from your database. Usually, you will be selective with how much data you want returned. If you have a lot of data in your database, you probably don’t want to see everything. More likely, you’ll only want to see data that fits a certain criteria.

For example, you might only want to see how many individuals in your database live in a given city. Or you might only want to see which individuals have registered with your database within a given time period.

The way to retrieve data from your database with SQL is to use the “SELECT” statement.

Using the SELECT statement, you can retrieve all records…
SELECT * FROM Individual

…or just some of the records:
SELECT * FROM Individual WHERE FirstName = ‘Homer’

The 2nd query only returns records where the value in the “FirstName” column equals “Homer”. Therefore, if only one individual in our database had the name “Homer”, that person’s record would be shown.




Comments are closed.