Basic 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.

4.74 ★★★★★ ★★★★★ (166 ratings)

1,655 learners enrolled

Lifetime access

limited to this course only

$39

Want a better deal?

Get unlimited lifetime access to all 71 present and future courses

Save $450

Unlimited lifetime access

to all 71 present and future courses

$149 $599

75% OFF

Free trial Yes

Certificate of completion Yes

Time to complete 10 h

Coding challenges 80

Skills you will gain

  • 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.

Last reviews

Table of contents

Course progress 0%

Exercises completed 0/80

  1. Create Your First Table

    0/12

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

  2. Primary keys and NOT NULL columns

    0/27

    How to tell the database that an id column is really an identifier and that a column value is obligatory.

  3. Foreign Keys

    0/20

    How to properly reference one table in another table.

  4. Modifying table structure

    0/14

    How to add, remove a table or change the structure of an existing table in a database.

  5. Final quiz

    0/7

    Time to test your knowledge!

Get the Certificate of Competency in SQL

This certificate will confirm your practical SQL problem-solving skills

Description

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

Cover image for the course 'The Basics of Creating Tables in SQL'

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

Reviews (0)

Average rating

4.74/5

★★★★★ ★★★★★ (166 ratings)

5 stars

75%

4 stars

25%

3 stars

0%

2 stars

0%

1 stars

0%