DB581 Introduction to SQL and Relational Databases via MariaDB
Duration: 3 Days
Intended Audience
There are no formal pre-requisites for this course. However, an understanding of databases and some exposure to information technology in general would be helpful. It is a course for beginners and developers who will be required to work with databases in general and MariaDB in particular.
Synopsis - Course Objectives
This course covers the basics of the SQL language as implemented by MariaDB.
It aims to provide delegates with practical experience in writing SQL statements and running these statements using the MariaDB client program and, also, MariaDB Workbench.
The basic SQL statements, including the use of SQL functions and the basic table and view handling statements are introduced.
Objectives
The DDL (Data Definition Language) and DML (Data Manipulation Language) parts of SQL are covered. DDL statements are used to create tables and other database objects. DML statements are used to query the database to extract information from it.
Skills learned will include:
- Using client programs to access a MariaDB database
- Creating, altering and dropping a MariaDB database
- Writing SQL statements to select data from a MariaDB database
- Writing joins and subqueries
- Using SQL expressions
- Using SQL aggregate functions and scalar functions
- Inserting, updating, deleting and replacing rows
- Creating and altering tables, indexes and views
- Using transactions
- Granting and revoking access privileges on tables and views
- Exporting and importing data
Course Outline
- Database Concepts
- Basic concepts - What is a database?
- Database management systems
- Tables, rows and columns
- Indexes, primary keys, unique constraints and foreign keys
- Client-Server architecture
- Data types supported by a database
- Storage engines and table types
- The Information_Schema and MariaDB Databases
- Working with the MariaDB client
- Overview of the MariaDB client
- Connecting to the database server and Logging in
- Selecting a database
- Client commands
- Entering and executing SQL statements
- Retrieving previous commands
- Creating, editing and executing SQL files
- Redirecting output into a file
- Command line execution of MariaDB scripts
- Basic SELECT statements
- The SQL SELECT statement - an overview
- Case sensitivity
- Quotes
- Statement terminator
- Syntax conventions
- The SELECT clause
- The FROM clause
- Conditions and the WHERE clause
- Logical operators
- The ORDER BY clause
- Column aliases
- Arithmetic expressions
- Precedence of operators
- LIMIT, UNION and Aggregate functions
- The LIMIT clause
- UNION
- UNION ALL
- Aggregate functions
- The GROUP BY clause
- Using Rollup with GROUP BY
- The HAVING clause
- Practical uses of Limit, Union and Aggregate Functions
- Subqueries and Joins
- Subqueries
- Cartesian products
- Joins with original syntax
- Table aliases
- Natural joins
- Join using
- Join on
- Multi-table joins
- Practical uses of Subqueries and Joins
- Numeric and Character functions
- Function types
- Testing functions
- Numeric functions
- Character functions
- Working with Numeric and Character Functions
- Date, Time and Other Functions
- Date and time column types
- Date and time formats
- The date format function
- Functions to return date time
- Functions to extract components from date time
- Date time arithmetic
- Miscellaneous functions
- Working with Date, Time and other functions
- Databases and Tables
- Creating a database
- Selecting a database
- Creating tables
- Auto_increment
- Show create table
- Column operations
- Constraint operations
- Copying tables
- Renaming tables
- Changing engine for tables
- Dropping tables
- Temporary tables
- Guidelines and patterns for maintaining databases and tables
- Indexes and Views
- What is an index?
- Creating an index
- Reviewing indexes
- Dropping indexes
- What is a view?
- Creating views
- View restrictions
- Dropping views
- Practical uses of indexes and views
- Managing Data
- Inserting rows
- Replacing rows
- Updating rows
- Deleting rows
- The truncate statement
- The COMMIT and ROLLBACK commands
- Savepoints
- Implicit commits
- Practical heuristics and patterns for managing data
- Access Control
- Creating users
- Renaming users
- Dropping users
- Granting privileges
- Revoking privileges
- Creating users, granting and revoking privileges
- Import and Export
- Exporting data using SQL
- Importing data using SQL
- Exporting databfrom the command line
- Importing data from the command line
- Export and import of data in practice