lecture+1
lecture+1
Introduction to SQL
LECTURE 1
Introduction
IITU, ALMATY
Course information
• Lectures
• Lab works + Quizzes (as defense)
(individual work, University database)
• Project
(teams of 1-3 students, individual topic)
Students
phone_
stud_id last_name DOB
number
001 student1 01.01.2000 1234567
• Examples.
Students (stud_id, last_name, first_name, DOB,
phone_number)
Groups (group_id, name, email)
Subject Area Analysis. Step 3
3. List and describe all relationships between entities.
1 student 1 group
Students Groups
many students 1 group
Subject Area Analysis. Step 4
4. List all constraints.
• The database reflects the real world, therefore, all restrictions that
exist at the real world should be reflected in the database for
convenient work.
• However, constraints should only apply to the information that is
stored in the database, otherwise they cannot be implemented. For
example, the Students table stores the date of birth, so we can write
the following constraint.
• Example.
Student’s date of birth must be later than 1980.
Subject Area Analysis. Step 5
5. Specify all groups of users and their access rights.
• Example.
User group: Students. Access rights: table Schedule (read-only).
Subject Area Analysis. Step 6
6. List all potential queries from users.
• Example.
Show last names of students by the name of a group
(show all students from the IT2-2101).
Show information about all groups.
Database management systems
Database management systems
(DBMSs) are specially designed
applications that interact with the user,
other applications, and the database itself
to capture and analyze data.
• PostgreSQL
• MS Access
• MS SQL Server
• Oracle
• MySQL
• etc
Why learn about databases?
• Nowadays databases are everywhere, but we
never see them. They are hidden behind the
tools and services that we use everyday.