This SQL tutorial helps you get started with SQL quickly and effectively through practical examples.
If you are a software developer, database administrator, or data analyst who wants to use SQL to answer questions through data, this tutorial is a great start.
Each topic is covered clearly and concisely with many practical examples so that you can both truly understand the concept and know how to apply it to solve the problems effectively.
SQL stands for structured query language designed to manipulate data in relational databases. Today, SQL is one of the most common programming languages for accessing data in the databases.
Section 1: Introduction to SQL
- What is SQL – give you a brief overview of the SQL language and its popular dialects.
- SQL Syntax – provide you with the syntax of the SQL language.
- SQL Sample Database – introduce you to an HR sample database.
Section 2: Querying Data
- SQL SELECT Statement – how to query data from a single table using the simplest form of the SELECT statement.
- Using SQL Aliases – make your query shorter and more understandable.
- SQL DISTINCT Operator – show you how to remove duplicates from the result set returned by the SELECT statement.
- SQL LIMIT – constrain a number of rows returned by a query using the LIMIT and OFFSET clause.
Section 3: Filtering Data
- SQL WHERE Clause – filter data based on specified conditions using the WHERE clause.
- SQL AND operator – combine multiple Boolean expressions using the AND clause to create a flexible condition.
- SQL OR operator – show you how to use another logical operator OR to combine multiple Boolean expression t
- SQL BETWEEN Operator – guide you to use the BETWEEN operator to select data within a range of values.
- SQL IN Operator – show you how to use the IN operator to check whether a value equals a list of values.
- SQL LIKE Operator – do you want to query data based on a specific pattern? use the LIKE operator.
- SQL IS NULL Operator – introduce the NULL concepts and show you how to check whether an expression is NULL or not
- SQL NOT operator – show you how to negate a boolean expression using the NOT operator.
- Rules of Precedence
Section 4: Sorting Data
- ORDER BY Clause – sort the data in ascending or descending order.
Section 5: Conditional Expressions
- SQL CASE Expression – add logic to the SQL statements.
Section 6: Aggregate Functions
- SQL AVG Function – calculate the average value of a set using the AVG function.
- SQL COUNT Function – return the number of rows in a set using the COUNT function.
- SUM Function – return the sum of a set using the SUM function
- SQL MAX Function – find the maximum value in a set using the MAX function.
- SQL MIN Function – find the minimum value in a set using the MIN function.
Section 7: Grouping Data
- SQL GROUP BY clause – group row into groups and apply an aggregate function to each group.
- SQL HAVING Clause – filter groups summarized by the GROUP BY clause.
Section 8: Joining Multiple Tables
- SQL INNER JOIN – introduce you to the join concept and show you how to use the INNER JOIN clause to query data from multiple tables.
- LEFT OUTER JOIN – provide you with another kind of joins that allows you to combine data from multiple tables.
- RIGHT OUTER JOIN
- FULL OUTER JOIN
- CROSS JOIN (Cartesian Product)
- SQL SELF JOIN – how to join a table to itself and when do you use it? welcome to the self-join tutorial.
Section 9: Using SET Operators
- UNION and UNION ALL Operators – combine result set of two or more queries into a single result set using the UNION and UNION ALL operators.
- INTERSECT Operator – show you how to get the intersection of two or more queries using the INTERSECT operator.
- MINUS Operator – shows you how to subtract a result set from another result set using the MINUS operator.
Section 10: Data Manipulation Language (DML) Statements
- INSERT statement – insert one or more rows into a table
- UPDATE statement – modify data in a table
- DELETE statement – remove rows from a table
- COMMIT and ROLLBACK Statements
Section 11: Data Definition Language (DDL) Statements
- SQL CREATE TABLE Statement – create a new table in the database using the CREATE TABLE statement.
- SQL ALTER TABLE Statement – modify the structure of an existing table with the ALTER TABLE statement.
- SQL DROP TABLE Statement – remove redundant tables permanently using the DROP TABLE statement.
- SQL TRUNCATE TABLE – remove all data in a big table fast and efficiently.
- RENAME Statement – change the name of a table with the RENAME table statement.
Section 12: Creating Constraints
- PRIMARY KEY Constraint – show you how to define a primary key for a table
- FOREIGN KEY Constraint – walk you through the steps of enforcing the relationship between data in two tables using the foreign key.
- UNIQUE Constraint – allow you to ensure the uniqueness of values in a column or a set of column
- NOT NULL Constraint – ensure that the values that being inserted or updated into a column are not NULL
- CHECK Constraint – validate the data before it is inserted or updated in one or more columns based on a Boolean expression.