cookies-icon

Our website uses cookies. By using this website, you agree to their use in accordance with the browser settings. You can modify your browser settings on your own. For more information see our Privacy Policy.

Advanced

Interactive Course

The Basics of Creating Tables in SQL

Discover the basic building blocks of creating tables in MySQL, SQL Server, Oracle, and PostgreSQL. Learn all about primary keys, foreign keys, and the CREATE TABLE command.

Table of contents
80

Interactive exercises

10 h

Estimated time

19

Users enrolled

☆☆☆☆☆
★★★★★

0 ratings

Welcome to The Basics of Creating Tables in SQL! This is the first course in the Creating Database Structure track.

In this course, you will learn the basics of creating and modifying tables in relational databases. First, we will show you the syntax of SQL’s CREATE TABLE command. Then you will master how CREATE TABLE works. We will also explain common table constraints: primary keys, foreign keys, and NOT NULL.

When you create a table in a relational database, you should always set up a primary key. This is a column or a set of columns that uniquely identifies each table row. We will show you how primary keys work and how you can define a single- or multi-column primary key.

A foreign key is a column or a set of columns that refers to another table. You will learn how to use these to establish relationships between tables.

Finally, you'll discover how to set up a NOT NULL constraint for a column. NOT NULL forces the user to always give a non-null value for this column.

This interactive tutorial is based on standard SQL and will give you the necessary foundation to work with any relational database engine. The syntax for CREATE TABLE and ALTER TABLE commands will work in all popular relational database management systems, including SQL Server, MySQL, Oracle, and PostgreSQL.

This is a course for beginner IT professionals and students. Are you a programmer, developer, or junior database administrator (DBA)? Do you need to learn to create tables in a relational database? Do you need a place to practise the SQL you've been learning? Then this course is for you.

In The Basics of Creating Tables in SQL, we:

  • Discuss the syntax of the CREATE TABLE command in SQL.
  • Define the concept, use, and creation of the PRIMARY KEY in SQL.
  • Show how NOT NULL constraints work and how to define them.
  • Define the concept, use, and creation of the FOREIGN KEY in SQL.
  • Demonstrate how to remove a table using DROP TABLE.
  • Explain how to rename tables and columns with the ALTER TABLE syntax.

This course is interactive. You’ll learn how to create tables by writing real SQL commands and solving exercises in your web browser. Our web-based platform runs your command and verifies your solution. You don’t need to install anything on your computer.

What Do You Need to Take This Course?

  • A web browser and an internet connection.
  • Knowledge of SQL, including SELECT, INSERT, UPDATE, and DELETE.

This Course Will Teach You How To:

  • Create a table in a relational database.
  • Define a primary key.
  • Define NOT NULL constraints.
  • Define foreign keys.
  • Remove a table from a database.
  • Alter and rename tables and columns.

Who Should Take This Course?

  • Beginning developers and programmers
  • Beginning database administrators (DBAs)
  • Students taking classes in relational databases
  • Anyone who wants to learn how to create tables in a database

Table of contents

Free

Paid content

0%

Course progress

0/80

Exercises completed

1. Create Your First Table

Remember what tables are? You will learn how to create simple tables.

0/12

Exercises completed

5. Final quiz

Time to test your knowledge!

0/7

Exercises completed

Upgrade

Reviews (0)

Average rating

3.5 / 5

☆☆☆☆☆
★★★★★

0 ratings

Details

5 stars

0%

4 stars

0%

3 stars

0%

2 stars

0%

1 stars

0%