0% found this document useful (0 votes)
13 views

SQL Concepts To Be Known

This document provides an overview and introduction to database concepts and SQL, including setting up databases in BigQuery. It covers topics such as database schemas, data types, keys, SQL commands like SELECT and JOIN, aggregation, filtering, subqueries, window functions, and date functions. Advanced concepts discussed include common table expressions, views, query optimization strategies, and database objects in MySQL like tables, indexes, and stored procedures.

Uploaded by

Dhanush N
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

SQL Concepts To Be Known

This document provides an overview and introduction to database concepts and SQL, including setting up databases in BigQuery. It covers topics such as database schemas, data types, keys, SQL commands like SELECT and JOIN, aggregation, filtering, subqueries, window functions, and date functions. Advanced concepts discussed include common table expressions, views, query optimization strategies, and database objects in MySQL like tables, indexes, and stored procedures.

Uploaded by

Dhanush N
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

Intro to Database and BigQuery Setup

🔸 What is a Database?
🔸 Database Management System
🔸 Database vs. Excel
🔸 DB Schema Design
🔸 Data Types
🔸 Concept of Keys
🔸 Data Warehouses

Extracting Data using SQL

🔸 Farmer's Database
🔸 Relationships
🔸 ER Diagram
🔸 SQL Commands
🔸 SELECT Query
🔸 ORDER BY
🔸 LIMIT & OFFSET
🔸 Inline Calculation
🔸 Alias (AS)
🔸 ROUND() function

Filtering Data in SQL

🔸 CONCAT
🔸 UPPER, LOWER
🔸 SUBSTR
🔸 INITCAP
🔸 WHERE clause
🔸 AND, OR, NOT
🔸 IN, BETWEEN
🔸 LIKE, Wildcards

Subqueries

🔸 DISTINCT
🔸 IS NULL, IS NOT NULL
🔸 TRIM()
🔸 Subqueries
🔸 CASE statement
🔸 IF, IFNULL()

Group By and Aggregation

🔸 MIN, MAX
🔸 SUM
🔸AVG
🔸COUNT
🔸Group By

Group By and Aggregation continued

🔸 Group By
🔸 COUNT(*) vs. COUNT(1)
🔸 COUNT DISTINCT
🔸 HAVING Clause
🔸 HAVING vs. WHERE

Joins

🔸 INNER JOIN
🔸 LEFT JOIN
🔸 RIGHT JOIN
🔸 FULL OUTER JOIN
🔸 UNION DISTINCT
🔸 UNION ALL

Joins continued

🔸 Joining Multiple Tables


🔸 Self JOIN
🔸 Cross JOIN
🔸 Non-Equi Joins

Window Functions

🔸 Over(), Partition By
🔸 Aggregated Window Functions
🔸 Row_number()
🔸 Rank(), Dense_rank()

Window Functions continued

🔸 Window Frames
🔸 Ntile()
🔸 Lag(), Lead()
🔸 First_value(), Nth_value()

Date & Time Functions

🔸 Datetime format
🔸 Parse_date()
🔸 Extract()
🔸 Date(), Time()
🔸 Date_add(), Date_sub()
🔸 Date_diff()
🔸 Current_date()

Advanced Constructs - CTEs & Views

🔸 Ad-hoc Reporting
🔸 Common Table Expression (CTE)
🔸 Advantages of CTEs
🔸 Views
🔸 When to use CTE vs. View?
🔸 Facebook’s interview question

SQL Query Optimization

🔸 Busting a common myth about the COUNT()


🔸 Selecting only the columns that you truly need
🔸 Why LIMIT can be a hidden pitfall
🔸 Harnessing EXISTS() instead of COUNT()
🔸 Leveraging APPROX_COUNT_DISTINCT for efficient counting
🔸 Swapping Self-Joins with Windows Functions
🔸 The art of trimming your data early and frequently
🔸 When to choose MAX() over RANK()
🔸 Importance of ordering your JOINs, from larger to smaller tables
🔸 Does the WHERE clause sequence really matter?
🔸 Should we push ORDER BY to the end of the query?

MySQL Setup & Intro to DDL, DML commands

🔸 MySQL Workbench Setup


🔸 Types of SQL commands
🔸 Constraints
🔸 Data Types
🔸 Data Definition Language (DDL) commands:
🔸 CREATE
🔸 ALTER
🔸 TRUNCATE
🔸 DROP
🔸 Data Manipulation Language (DML) commands:
🔸 INSERT
🔸 UPDATE
🔸 DELETE

SQL Advanced Concepts

🔸 Partitioning
🔸 RANGE partition
🔸 LIST partition
🔸 HASH partition
🔸 Indexes
🔸 EXPLAIN
🔸 CREATE INDEX
🔸 DROP INDEX
🔸 User-defined Functions
🔸 Stored Procedures

You might also like