WGU c170 The Most Important SQL Commands(SQL study guide)
WGU c170 The Most Important SQL Commands(SQL study guide) Notes for C170 Some of The Most Important SQL Commands SELECT - extracts data from a database UPDATE - updates data in a database DELETE - deletes data from a database INSERT INTO - inserts new data into a database CREATE DATABASE - creates a new database ALTER DATABASE - modifies a database CREATE TABLE - creates a new table ALTER TABLE - modifies a table DROP TABLE - deletes a table CREATE INDEX - creates an index (search key) DROP INDEX - deletes an index '*' select all the columns Example: SELECT * FROM Customers; 'FROM' pulling info from database 'DISTINCT' = Different Example: SELECT DISTINCT or SELECT FROM Note: The WHERE clause is not only used in SELECT statements, it is also used in UPDATE, DELETE, etc.! ***GOOD EXAMPLES:** SELECT * FROM Customers WHERE City = 'Berlin' OR City = 'London'; SELECT * FROM Customers WHERE Country='Germany' OR Country='Spain'; SELECT * FROM Customers WHERE Country='Germany' AND (City='Berlin' OR City='München'); SELECT * FROM Customers WHERE NOT Country='Germany' AND NOT Country='USA'; SELECT * FROM Customers ORDER BY Country DESC; SELECT * FROM Customers ORDER BY Country, CustomerName; SELECT * FROM Customers ORDER BY Country ASC, CustomerName DESC; INSERT INTO Customers (CustomerName, ContactName, Address, City, PostalCode, Country) VALUES ('Cardinal', 'Tom B. Erichsen', 'Skagen 21', 'Stavanger', '4006', 'Norway'); INSERT INTO Customers (CustomerName, City, Country) VALUES ('Cardinal', 'Stavanger', 'Norway');
Document information
- Uploaded on
- November 30, 2022
- Number of pages
- 8
- Written in
- 2022/2023
- Type
- Exam (elaborations)
- Contains
- Questions & answers