This tutorial will guide you through the fundamental concepts of accessing and manipulating data in a relational database. We'll start with basic data retrieval and simple update operations.
The SELECT statement allows you to retrieve specific data from a table. Let's see an example:
SELECT *
FROM Customers
WHERE Country = 'USA';
This query retrieves all columns and rows from the 'Customers' table where the 'Country' column is equal to 'USA'.
The UPDATE statement modifies existing data. Let's update the 'Age' of a customer:
UPDATE Customers
SET Age = 30
WHERE Country = 'USA';
This update sets the 'Age' of the customer with the Country 'USA' to 30.
The LIMIT clause limits the number of rows returned. Let's get the first 5 customers:
SELECT *
FROM Customers
LIMIT 5;
This returns only the first 5 customers.
Here's another example: SELECT * from Orders WHERE OrderDate > '2023-01-01';
This is a basic introduction to database access. Further learning involves advanced techniques like joins, aggregations, and stored procedures.