
In this video we explore why it is worth learning SQL and why it is a long-term skill which will be valuable for many years to come.
Here we shortly look at a couple of ways how this course can help advance your career.
Here we answer the question "Should I learn SQL, when I can use Object-Relational-Mapping (ORM) to access data storage?"
See how SQL databases become a long-term skill you can apply to many projects, building on core concepts and paving the way to start working with it.
Here we look at the overall architecture of solutions involving SQL: you application (client) which connects to a database engine (server), using a library (driver).
Here we identify step-by-step instructions - all you have to do to set up an SQL database and access it from a programming language.
Before jumping in to database component overview, we take a step back and look at the general concept of "data" and "information".
We talk about the main components stored in SQL: the databases and their tables, as well as database users.
A closer looks at SQL tables, rows and columns.
A quick mention of possible relationships between the tables.
Here we look at some examples of connecting to an SQL database from popular programming languages: Java, Python, PHP.
Have you been wondering whether SQL is accessible from Javascript in websites?
SQL statements and queries, and the general pattern of sending them from a programming language.
Statement and query examples in Python and Java
Section summary, quick hint of the content in the next section.
Install MySQL by following official instructions; set up the database server and client, install language drivers, and optionally add a database administration tool, with Windows steps and Linux/macOS links.
Install the MySQL community server on Windows and choose server only with port 3306. Start the Windows service, set a root password, and test the connection.
Open and configure the MySchool database by creating a new MySQL connection, verifying host, port, and credentials, installing the driver, and debugging the public key retrieval issue.
Define table columns by name and type, noting types vary by database system. Explore common types like integers, decimals, date/time, strings, and binaries, and use them for arithmetic.
Learn how to escape reserved keywords with backticks to safely name tables or columns like order, avoiding syntax errors and enabling flexible database design.
Learn to create a database and a store table in sql, define id as auto increment primary key with name and address, and use database.table syntax.
Alter table lets you modify a table after creation by listing actions (add, drop, rename, change) including primary keys, separated by commas and ending with a semicolon.
Drop the employee table, then restore the database by importing the provided Eskil dump from lecture resources to recover the original structure.
Insert data into tables using the insert into statement to add rows to the employee table, with case-insensitive keywords, specifying columns and values in quotes, ending with a semicolon.
Insert two employees into the employees table, including Charlie Young at 1.85 meters and Other Lovelace at 1.77 meters, to practice SQL insert operations.
Insert two people into the employee table using first_name, last_name, and height, then verify that two new rows appear.
Create a product table with id as an auto incrementing primary key, and name as a string and quantity as an integer defaulting to zero.
Extend the product table by adding a new column named added with a default today's date, then insert a couple of products and verify the added column shows the date.
Learn to query data from a single table using the select statement, understand its parts and the importance of order, and know that queries return a table.
Learn how to select specific columns in SQL by using projections instead of select asterisk, returning only name and quantity from the product table.
Practice using expressions in select statements to convert heights from meters to feet and apply arithmetic on single or multiple columns, including plus, minus, multiplication, and division.
Use the attached .sql file to add two extra columns to the product table and insert some more products and employees. This will be necessary to follow along the examples shown in the rest of the course.
You can either copy the SQL statements from the attached file and run them in the DBeaver tool's query editor, or you can import it as a "database backup" (also called "database dump"). In DBeaver that is done by right-clicking on the database > Tools > Restore database, then choose the attached .SQL as the input file. In other tools - look for an option to restore database from an SQL file.
Note: the attached SQL file contains only the new two columns and the new data inserts! It assumes that you have the structure of the database as it was at the end of the previous section of the course!
Learn how the where clause filters rows by evaluating a condition for each row and returns only those that satisfy it, illustrated with employee and product table examples.
Learn how to combine conditions with logical operators using and, or, and not in SQL. Explore practical examples—range filters, or-conditions, and complex first-name and height queries—highlighting potential surprises.
Explore how operator precedence shapes SQL queries, with arithmetic, comparison, and logical operators, and learn to enforce the intended order using parentheses.
Learn substring search in sql using the like operator with the % wildcard to pattern-match names. Discover case-insensitive matching that finds starts-with and contains patterns, returning Chuck, Charlie, and Jack.
Group data by chosen columns and apply aggregates to each group to produce counts and sums. Group by single or multiple fields, and order results by category or first name.
Learn to insert null values in sql by using insert into statements for two products with unknown quantity and category, where weight is 0.01.
Learn how null values influence expressions and comparisons in SQL, where unknowns yield null in arithmetic and cannot be compared, leaving only null or not null checks.
Explore how null values affect aggregation in sql, learning how averages and sums treat unknowns, the difference between count(*) and count(column), and grouping by nulls.
Practice delete statements by removing all products with no weight, using a proper delete statement. Consider exporting data, backing up the database, and restoring from backup in the next video.
This is an intensive crash-course of SQL databases, the absolute essence. It contains everything you need to know to jump into real SQL database projects. And you can do it in a single weekend!
You will learn:
What SQL databases are and how they are structured
How to set up the necessary tools to get started
How to CREATE TABLEs and modify their structure later
How to export the data and table structure to a backup-file, and restore a database from a backup
How to INSERT data
How to write queries to SELECT the necessary data, including WHERE conditions, ORDERing, aggregation and GROUP BY, conditions * and functions.
What the mysterious NULL values are and why they behave so weirdly
How to DELETE data
How to UPDATE data
How to link together tables and select data from multiple tables using JOINs
The course contains a great deal of practical exercises:
Short quizzes to test your understanding along the way
Exercises in every section, including an extensive set of exercises using multi-table SELECTs with JOIN
A course project in Python and Java where you will read data from an SQL databases in your program
We will use the MySQL database engine - one of the most popular choices of SQL, a free and open-source solution.
Check out the free videos and see you in the course!