- SQL consists of keywords
- SELECT, FROM, WHERE are three such.
- These three allow you to SELECT columns FROM a table WHERE rows meating a specification are met.
- The case for keywords does not matter.
- Whitespace in commands, other than as a delimiter, does not matter.
- Comments are as per c (/* */ ) but can be multiline.
- All commands end with a ;
- The simplest (in my opinion)
-
Select *
From SKU_DATA;
-
Select Buyer, Department
From SKU_DATA:
-
Select Department, Buyer
From SKU_DATA:
- Just a few notes to help me out.
- show tables;
- describe RETAIL_ORDER;
- Distinct can be used to eliminate duplicate data.
-
Select DISTINCT Buyer, Department
From SKU_DATA;
- The Where clause allows us to select distinct rows.
-
Select *
From SKU_DATA
Where Department="Water Sorts";
- Text and date muist be in quotations
- Basic comparison operators are allowd, (=, <>, >, < <=, &th;=)
- There is more than this, but it will do for now.