Create a free account to track your lessons and quizzes across devices.
Register Login
The World of Data - Introduction to Databases
Page 4 of 4
The Language of Data: A brief introduction to SQL (Structured Query Language)
SQL (Structured Query Language), often pronounced "sequel," is the standard programming language used to communicate with and manage data in a relational database. It provides a simple, English-like syntax for performing all necessary data operations.
You can think of SQL as the universal remote control for relational databases. While there are different database systems (like MySQL, PostgreSQL, SQL Server, and SQLite), they all understand SQL.
SQL commands can be broken down into four main functions, often remembered by the acronym CRUD: Create, Read, Update, and Delete.
The Four Most Common SQL Statements:
-
SELECT(Read): This is the most common command, used to retrieve or query data from one or more tables.- Example:
SELECT FirstName, LastName FROM Customers WHERE State = 'California';- This command would retrieve the first and last names of all customers who live in California.
- Example:
-
INSERT(Create): Used to add a new row (record) of data into a table.- Example:
INSERT INTO Customers (FirstName, LastName, Email) VALUES ('Jane', 'Doe', 'jane.doe@example.com');- This command adds a new customer named Jane Doe to the
Customerstable.
- This command adds a new customer named Jane Doe to the
- Example:
-
UPDATE(Update): Used to modify existing records in a table.- Example:
UPDATE Customers SET PhoneNumber = '555-1234' WHERE CustomerID = 101;- This command changes the phone number for the specific customer with the ID of 101.
- Example:
-
DELETE(Delete): Used to remove one or more records from a table.- Example:
DELETE FROM Customers WHERE CustomerID = 101;- This command permanently removes the customer with the ID of 101 from the table.
- Example: