OLD but GOLD: SQL is better than you know! Brief History ● Created to handle from up to 10 to 100M rows or around 100MB/table ● Now supports terabyte-sized databases ● Supports SQL standards as new as SQL 2016 ● But... some stuff from SQL 2003 just became available (Window Functions, CTEs) ● What is new? 23 OF MAY 1995 GPL V2 User Management User Management ● Reusable Permissions/Roles ● Password policy ● New Password ● Reuse of Password ● Expiration ● Rotation User Management ● GRANT doesn’t create users anymore, it just... grants!!! ● No more googling all the time how to create users with the right permissions! Creating a READONLY role CREATE ROLE 'readonly' ; GRANT SELECT ON app. * TO 'readonly' ; ● Create the Role ● Define the Privileges Creating a user with READONLY role ● Create the User ● Grant the Role CREATE USER 'gabriela' @ '%' IDENTIFIED BY 'my_pwd' ; GRANT 'readonly' TO 'gabriela' @ '%' ; CREATE TABLE Non-deterministic defaults are now supported FUNCTIONS or EXPRESSIONS inside CREATE TABLE Better UUID() support! UUID() Support CREATE TABLE users ( uid binary (16) NOT NULL DEFAULT (UUID_TO_BIN( UUID ())), username varchar (255) NOT NULL , PRIMARY KEY ( uid ) ); New Defaults & Variables New default Charset ● Default: ● 5.7: latin1 ● 8.0: utf8mb4 ● Improvements: ● ➕ Mathematical Equations 𝑒 = 𝑚 · 𝑐 ² ● 😁 🙄 🤦 ● & more SMP (Supplementary Multilingual Plane) Characters New default Collation ● utf8mb4_0900_ai_ci ● UTF-8 version 9.0 support ● Accent Insensitive ● Case Insensitive ● No more 🍣 = 🍺 bug ● Caused by utf8mb4_general_ci or utf8mb4_unicode_ci Other defaults & variables ● Binary log ( log_bin ) is enabled by default ● SHA-2 for authentication ● Mandatory default value for TIMESTAMP ● New variable to dedicated servers (default OFF ), innodb_dedicated_server=ON , controls dynamically: ○ innodb_buffer_pool_size ○ innodb_log_file_size ○ innodb_flush_method CHECK Constraint CHECK Constraint Rules ● Non-generated and generated columns are permitted, except columns with the AUTO_INCREMENT attribute. ● Literals, deterministic built-in functions, and operators are permitted. ● Non-deterministic built-in functions (such as AVG , COUNT , RAND , LAST_INSERT_ID , FIRST_VALUE , LAST_VALUE , ...) are not permitted. ● Sub-queries are not permitted. CHECK Constraint Rules ● Environmental variables (such as CURRENT_USER , CURRENT_DATE , ...) are not permitted. ● Variables (system variables, user-defined variables, and stored program local variables) are not permitted ● Stored functions and user-defined functions are not permitted CHECK CREATE TABLE order_items ( id INTEGER AUTO_INCREMENT NOT NULL , product_id INTEGER NOT NULL , user_id INTEGER NOT NULL , quantity INTEGER , price DECIMAL (10, 2), PRIMARY KEY ( id ), CONSTRAINT `chk_quantity` CHECK ( quantity > 0) );