Creation and management of SQL databases

In this section we will see the basic statements and instructions, both DDL and DML to start database development: from the creation of a database, modification and deletion, to the insertion of records in the tables it contains and their manipulation

12 lessons 3 with examples you can run

  1. CREATE DATABASE statement in SQL

    CREATE DATABASE, is the DDL statement, which allows us to create databases within our management system. In this section we will learn how to create a specific database, both by SQL commands and by the graphical editing tool

  2. CREATE SCHEMA statement in Transact SQL

    CREATE SCHEMA is the DDL statement that enables us to create a new schema in a new database. In this section we will see what a schema is, the system's default schemas, how to create them and grant them permissions

  3. CREATE TABLE statement in SQL

    CREATE TABLE, is the DDL statement that allows you to create tables in a specific database. In this section we will see how to declare the columns along with the data type, properties and restrictions when executing the statement.

  4. ALTER TABLE statement in SQL

    ALTER TABLE is the DDL statement to add, remove or modify columns in a table, as well as to add or remove constraints on it. In this section we will see graphically and with examples, how to use this sentence

  5. Indexes in SQL: CREATE INDEX

    An index lets the database find rows without scanning the whole table. We will see how to create indexes with CREATE INDEX, the difference between clustered and nonclustered, unique and composite indexes, and when not to create them

    Runnable examples

  6. DROP TABLE statement in SQL

    DROP TABLE is the DDL statement to drop tables along with all their data, indexes, triggers, constraints, and permissions

  7. INSERT INTO statement in SQL

    INSERT INTO is the DML statement for inserting records into database tables. In this section we will see how to apply the sentence, taking into account the nature of the data, properties and restrictions in handling the information

  8. Statement BULK INSERT in Transact SQL

    BULK INSERT is the DML statement that allows you to insert records into a table or view from an external file, usually a CSV file

  9. UPDATE statement in SQL

    UPDATE is the DML command that allows you to update database records. In other words, UPDATE allows you to modify the values of the columns of the tables respecting the corresponding data type

    Runnable examples

  10. DELETE statement in SQL

    DELETE is the DML command to delete records from database tables. In its execution, it is very important to take into account the WHERE clause, to prevent the changes from being propagated and all the records from the table being deleted

    Runnable examples

  11. TRUNCATE TABLE statement in SQL

    TRUNCATE TABLE is the DML statement that allows you to delete all the data from a table without affecting its schema and structure. Unlike the DELETE FROM statement, TRUNCATE TABLE does not allow the WHERE clause to be used

  12. GRANT and REVOKE statements in Transact SQL

    DCL (Data Control Language) is the language in charge of managing access to the database and its contents, mainly through the GRANT statements (to grant permissions) and REVOKE (to eliminate existing permissions.

What you will learn in this section

This is where we build the database used in the rest of the course: a small shop with the Customers and Orders tables.

The statements fall into two families:

The section ends with GRANT and REVOKE, which control who can do what on each object.

In the UPDATE and DELETE lessons you can run the examples in your browser and see the effect straight away: changes are rolled back automatically, so you can experiment without breaking anything.