DB583 MariaDB - An Intensive Introduction to MariaDB for Developers
Duration: 5 Days
Intended Audience
This course is for MariaDB Developers who have a basic understanding of a MariaDB database and SQL commands as covered in introductory courses and who need to master the more advanced aspects of SQL and MariaDB
Synopsis - Course Objectives
The course covers more advanced MariaDB commands and SQL statements including Stored Routines, Triggers and Event Scheduling. Its aims are to provide attendees with the skills needed to write more advanced queries and database maintenance statements on a MariaDB database.
Subjects covered include:
- Working with advanced features of the MariaDB Client
- Exploring data types in depth
- Management of the structure of databases and tables
- Management and use of indexes
- Complex SQL query statements
- Advanced SQL expressions and functions
- More complex Insert, Update, Delete, Replace and Truncate Operations
- Mastering the user variable syntax and properties
- Importing and exporting data from within MariaDB
- Importing and exporting data from the command line
- Using complex joins to access multiple tables
- Solving data retrieval problems that require the use of complex subqueries
- Creating, managing and using views
- Using MariaDB Connectors
- Integration of MariaDB and NoSQL
- Using prepared statements
- Creating and using stored routines
- Creating and using triggers
- Accessing and utilising database metadata
- Techniques for query optimisation
- Knowing how to make best use of the main storage engines
- Debugging MariaDB applications
Course Outline
- Client/Server Concepts
- MariaDB client/server architecture
- Server modes
- Using client programs
- Logging in options
- Configuration files
- Precedence of logging in options
- The MariaDB Client Program
- MariaDB interactive usage
- The MariaDB Client prompts
- Client commands and SQL statements
- Editing
- Selecting a database
- Help
- Safe updates
- Using script files
- Using a source file
- Redirecting output into a file
- Command line execution
- MariaDB output formats
- Overriding defaults
- HTML and XML output
- Overview of MariaDB Utilities
- Data Types
- Bit data type
- Numeric data types
- Auto_increment
- Character string data types
- Character sets and collation
- Binary string data types
- Enum and Set data types
- Temporal data types
- Timezone support
- Spatial Datatypes
- Handling Missing Or Invalid Data Values
- SQL_MODE options
- Identifiers
- Identifier naming and the use of quotation marks
- Case sensitivity in Identifier naming
- Qualifying columns with table and database names
- Using reserved words as identifiers
- Function names
- Databases
- Database properties
- Creating a database
- Selecting a database
- Altering a database
- Dropping a database
- Obtaining database metadata
- The SHOW command
- The INFORMATION_SCHEMA database
- The SHOW CREATE command
- Tables and Indexes
- Table properties
- Creating tables
- Create a table using Select or Like
- Temporary tables and memory tables
- Altering tables
- Adding columns
- Changing column widths and types
- Renaming columns
- Dropping columns
- Adding constraints
- Dropping constraints
- Renaming tables
- Change the table storage engine
- Multiple alterations
- Dropping tables
- Emptying tables
- Obtaining table metadata
- Show create table
- The information_schema
- Basic indexing concepts
- Structure of a MariaDB index
- Creating and dropping indexes
- Creating an index
- Altering a table to add an index
- Specifying an index type
- Obtaining Index Metadata
- Data Querying
- The ANSI Stabdard SQL select statement and non standard MariaDB features
- Advanced order by
- Order by and collation
- Order by with enum datatype
- Order by with Set datatype
- Ordering with distinct and group by
- Special features of union
- Limit and order by clauses
- Group By clause
- Group_concat
- Using Rollup in a Group By clause
- SQL Expressions and Functions
- Components of expressions
- Nulls
- Numeric expressions
- String expressions
- Temporal expressions
- Comparison functions
- Flow control functions
- Numeric functions
- String functions
- Temporal functions
- Updating Data
- Privileges needed to be able to perform Update operations
- Inserting rows
- Insert using a set clause
- Inserting duplicate values
- Replacing rows
- Updating rows
- Update using the order by and limit clauses
- Deleting rows
- The delete and truncate statements
- Connectors
- MariaDB client interfaces
- MariaDB connectors
- Oracle and community conectors
- Connecting to MariaDB server using Java and PHP connectors
- MariaDB and NoSQL
- Innodb integration with memcached
- Obtaining Database Metadata
- What is metadata?
- The MariaDBshow utility
- The show and describe commands
- Describing tables
- The information_schema
- Listing tables
- Listing columns
- Listing views
- Listing key_columns_usage
- Debugging
- MariaDB error messages
- The show statement
- Show errors
- Show count(*) errors
- Show warnings
- Show count(*) warnings
- Note messages
- The perror utility
- Joins
- Overview of inner joins
- Cartesian product
- Inner joins with original syntax
- Non equi-join
- Using table aliases to avoid name clashes
- Inner Joins With ISO/ANSI Syntax
- Outer Joins
- Left outer joins
- Right outer joins
- Full outer joins
- Updating multiple tables simultaneously
- Updating rows in one table based on a condition in another
- Updating rows in one table reading data from another
- Deleting from multiple tables simultaneously
- Deleting rows in one table based on a condition in another
- Subqueries
- Types of subquery
- Multiple-column subqueries
- Correlated subqueries
- Using the ANY, ALL and SOME operators
- Using the EXISTS operator
- Subqueries as scalar expressions
- Inline views
- Converting subqueries to joins
- Using subqueries in updates and deletes
- Views
- Why views are used
- Creating views
- View creation restrictions
- View algorithms
- Updateable views
- Altering and dropping views
- Displaying information about views
- Privileges for views
- Exercises: Using views
- Import and Export of Data
- Exporting using SQL
- Privileges required to export data
- Importing using SQL
- Messages when loading data
- Privileges required to load data
- Exporting from the command line
- MariaDBdump main options
- Importing from the command line
- MariaDBimport main options
- User Variables and Prepared Statements
- Creating User variables
- User variables in a select
- Prepared statements
- The prepare statement
- The execute statement
- The deallocate statement
- Using prepared statements in code, with connectors
- Introduction to Stored Routines
- Types of stored routines
- Advantages of using stored routines
- Stored routine features
- Differences between procedures and functions
- Introduction to the Block
- Declaring variables and constants
- Assigning values to variables
- Definer rights and invoker rights
- Using SELECT in stored routines
- Altering and dropping stored routines
- Obtaining stored routine metadata
- Stored routine privileges and execution security
- Stored Routines - Program Logic
- The IF .. THEN .. ELSEIF construct
- The CASE statement
- The basic loop
- The while loop
- The repeat loop
- The iterate statement
- Nested loops
- Stored Routines - Exception Handlers and Cursors
- Dealing with errors using Exception handlers
- Cursors
- What is a cursor?
- Cursor operations
- Declaring cursors
- Opening and closing cursors
- Fetching rows
- Status checking
- Exercises: Writing stored routines with program logic
- Procedures with Parameters
- Creating procedures with parameters
- Calling Procedures With Parameters
- Functions
- What is a function?
- The create function statement
- Executing functions
- Executing functions from code
- Executing functions from SQL statements
- The deterministic and SQL clauses
- Triggers
- Trigger creation
- Restrictions on triggers
- The create trigger statement
- Using the old and new qualifiers
- Managing triggers
- Destroying triggers
- Required privileges
- Basic Database Optimization
- Normalisation of data to third normal form
- Using indexes for optimization
- General query enhancement
- Using Explain to analyze queries
- Choosing an INNODB or MYISAM storage engine
- Using MariaDB Enterprise Monitor in query optimization
- Indexes in greater depth
- Indexes and joins