Skip to content

SColson82/SQL_Fun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQL_Fun

From the LinkedIn Learning Course "SQL Essential Training"

Objective: Learn a new SQL tool (SQLiteStudio) and further familiarize myself with essential SQLite functions.

Skills Covered:

  • How DataBases are organized
  • Selecting rows and columns
  • Creating new tables
  • Inserting and updating data
  • Sorting and filtering
  • Accessing related tables with JOIN
  • Working with strings
  • Understanding numeric types
  • Using aggregate functions and transactions
  • Automating data with triggers
  • Creating views
  • Using CRUD functions

Fundamental Concepts:

  • CREATE TABLE
  • INSERT INTO
  • DROP TABLE / DROP TABLE IF EXISTS
  • ID
  • NULL
  • SELECT
  • DELETE
  • Constraints: UNIQUE
  • ALTER TABLE
  • WHERE, LIKE, IN
  • SELECT DISTINCT
  • ORDER BY
  • CASE WHEN

alt text

alt text

alt text

alt text

alt text

alt text


String Functions:

  • SINGLE QUOTES
  • CONCATENATION

alt text

  • LENGTH

alt text

  • SUBSTR

alt text

  • TRIM

alt text

  • UPPER/LOWER

alt text


Numeric Types:

alt text


DATE/TIME:

alt text


Aggregations:

  • HAVING clause opperates on aggregated data
  • WHERE is used before a GROUP BY, HAVING is used after GROUP BY and before ORDER BY
  • AGGREGATE functions include but are not limited to: COUNT, AVG, MIN, MAX, SUM.

alt text


Transactions:

  • Transactions are a group of operations that are handled as one unit of work. They improve performance.
  • Transactions can add information to one table and remove the same information from another table at the same time.

alt text

  • ROLLBACK is used to undo a transaction before it is completed in the event of an error.

alt text

  • This insert statement adding 1000 lines to a table required 2.024 seconds to run without transaction. With transaction it required 0.036 seconds.

alt text


Triggers

  • Triggers are operations that are automatically performed when a specified database event occurs.

alt text

  • Triggers can also be used to prevent unwanted updates.

alt text

  • They can be used to add a timestamp when tables are updated.

alt text


Subselects / Nested Queries

alt text


Views:

  • Views are used to create a copy with the intent of data manipulation and exploration.

alt text


And one last nifty thing to remember when dealing with times.

alt text

Releases

No releases published

Packages

No packages published