Sitemap
SQLGate

The Most Intelligent IDE for Database, SQLGate

[SQL Basic] Let’s see some Sample Database tables!

5 min readAug 27, 2018

--

#8. Marketing/Data Analysis for Beginners

Press enter or click to view image in full size

We’re halfway through the basic SQL tutorials now, so let’s take a break from learning SQL and take a closer look at our database tables. Even though we’ve dabbled in other tables, our main focus has been on the film table so far. In today’s lesson, we will take a closer look at our sample database tables for a better understanding.

So far we have used five tables: film, customer, address, country, and city. In the sakila database, there are a total of 16 tables. You can check them out on Object Explorer and Object panel in SQLGate.

🔑 If you closed this window or can’t find it, open it by going to the top menu:
View → Object Explorer.

Press enter or click to view image in full size

As explained in our first tutorial, each table has columns and data that belongs to it. Let’s review the tables we’ve used so far!

#1. Film Table

View the film table by opening the table drop-down list (click the +) and double click on the film table.

Press enter or click to view image in full size

There are 13 columns available in the film table: film_id, title, description, release_year, language_id, original_language_id, rental_duration, rental_rate, length, replacement_cost, rating, special_features, and last_update.

Get SQLGate Global’s stories in your inbox

Join Medium for free to get updates from this writer.

We’ve mainly used film_id, title, description, rental_duration, and rental_rate. Let’s take a look at the database more closely by clicking the Data tab at the top (between the Column and Index tabs). If it’s not checked, click on the box next to Limit inside your Data tab. Set the limit to 100
and click Apply.

Press enter or click to view image in full size

Here, 0 means the offset and 100 means the number of data you want to see.

#2. Customer Table

Press enter or click to view image in full size

The customer table was used in the 4th tutorial in the Practice Time example. The number of columns is smaller and easier to navigate than the film table. There are only 9 columns: customer_id, store_id, first_name, last_name, email, address_id, active, create_date and last_update.

Press enter or click to view image in full size

The address_id column is also in the address table.

#3. Address Table

Press enter or click to view image in full size

We used the address table in the 5th tutorial and the 7th tutorial. This table has 9 columns as well: address_id, address, address2, district, city_id, postal_code, phone, location, and last_update. The address_id column links the customer and address tables together.

Press enter or click to view image in full size

#4. Country Table

Press enter or click to view image in full size

The country table is also covered in the 5th tutorial. This table only has 3 columns: country_id, country, and last_update.

Press enter or click to view image in full size

The country_id column will appear again in the city table.

#5. City Table

Press enter or click to view image in full size

The city table is also covered in the 5th tutorial just like our country table. There are a total of 4 columns here: city_id, city, country_id, and last_update. We can see the city_id column that appeared in the customer and address tables, connecting this table’s information to that one. The country_id column is connected to the country table.

Press enter or click to view image in full size

As you can see, there are many columns that connect all the tables to each other (excluding the film table). Now that we have a good understanding of what’s inside each table, we can learn the function of joining these tables together. It will be easy to connect and use all the information if you know which columns are connecting which tables.

Click to Download SQLGate Free Version

--

--