Structured Query Language

Accessing DB from Python

SQL questions!

SQL code zip file → https://codewithmosh-assets.netlify.app/assets/sql-course-materials.zip

Basics


USE sql_store;

SELECT *
FROM customers
WHERE state = 'CA'
ORDER BY first_name
LIMIT 3;

Comments We use comments to add notes to our code.


-- This is a comment and it won't get executed.

SELECT Clause


-- Using expressions
SELECT (points * 10 + 20) AS discount_factor
FROM customers

Order of operations: