Introduction to
SQL
Learn the Basics of Structured
Query Language
What is
SQL? SQL = Structured
Query Language
Used to
communicate with
databases
Why
Learn
SQL? Used in data
Essential for data
analysis & science,
database backend
management development,
and reporting
SQL Basics Database: Collection of
organized data
– Database
Concepts Table: Structure with rows and
columns
Row: Single record
Column: Field of data (e.g.,
name, age)
Basic SQL
Syntax
SELECT column1, column2
FROM table_name
WHERE condition;
• Semicolon ends a statement
• Use * to select all columns
SELECT
Statement
SELECT * FROM characters;
• Fetches all data from the characters
table
• Most commonly used SQL command
WHERE Clause
SELECT * FROM characters
WHERE role= “ Super Hero”
Filters results based on condition
Operators : =,<,>,=,And, Or,
Between
How to get SQL view
Click on Create
Click on Query Design
Click on SQL view
• Click on SQL View
• After writing the
Query example is
shown in the
image.
• Click on Run
Note Ensure the
table you intend
to query is
created before
writing the SQL
statement.
🎯 Goal: Retrieve data from a table
Let's say we have a table called students with the following structure
✅ SQL Command (Query):
SELECT name,age
FROM students;
🔍 Explanation:
SELECT - tells the database what columns you want to see.
name, age - the specific columns we want to retrieve.
FROM - specifies the table we're selecting data from.
SELECT * FROM students
This will return every column in the students table
🎯 Goal: Find students who are 14
years old.
• ✅ SQL Command:
SELECT name, age
FROM students
WHERE age = 14;
SELECT name ,age- We want to see the students' names and ages.
FROM students- From the students table.
WHERE age =14 – only returns where age is 14.
What is the expected result?
Steps to follow for Practicals
Open word document
Write your name, grade ,section, date, Title.
• Create a students table
• Take the screen shot of design view of table.
• Copy paste in the word document.
• Take the screen shot of datasheet view paste in the word document.
• Write the Query number.
• Open SQL view
• Write the command.
• Take the screen shot of SQL query paste it in the word document.
• Run the Query.
• Take the screen shot of datasheet view.
• Take the printout.
SQL Query 1
• Create a students table as it is shown below.
Write a SQL command to retrieve the names of the students those are
of age 15
SQL Query 2
• Write a SQL command to retrieve the name and age
of the students those are studying in grade 8.
SQL Query 3
Write a SQL command to retrieve all the details
whose name is 'Bob'.
Thank
you