Procedural Query Languages
Procedural Query Languages
Dr. Jayashree T R
Course Outline
Course Plan: Theory:
Part A: Parallel Computer Architectures
Week 1: Introduction to to the course, highlighting the data and databases, and related basic
concepts. Advantages and need for a database system.
Week 2: Attributes, tuples, relational schema, conceptual model, introduction to SQL-DML, DDL,
creating relations/ tables, access and manipulate data.
Week 3,4: Data model, relational model, and SQL, relational data model and relational database
constraints, SQL data definition and data types, specifying constraints, basic retrieval queries, complex
quires, triggers, views, schema modification.
Week 5-6: ER model development, entity types/sets, attribute, relationship types/sets, simple employee
database conceptual design using ER concepts, ER to relational mapping algorithm, EER model.
Course Outline
• The relational algebra and calculus were developed before the SQL language.
SQL is primarily based on concepts from relational calculus and has been extended
to incorporate some concepts from relational algebra as well.
Now, if you apply the projection operator to select the Name column from the
π
relation, ( Name (STUDENT):
STUDENT
For example, to list each employee’s first and last name and salary, we can use the
PROJECT operation as follows:
Employees
2 Bob 25
3 Charlie 28
1 Alice 30
select operation (σ) to find all employees with the name "Alice":
σName='Alice'(Employees)
Example of applying SELECT OPERATION:
For example, To select the tuples for all employees who either work in department 4 and make
over $25,000 per year, or work in department 5 and make over $30,000, we can specify the
following SELECT operation:
SELECT *
FROM EMPLOYEE
WHERE Dno=4 AND Salary>25000;
πFname, Lname, Salary(σDno=5(EMPLOYEE))
DEP5_EMPS ← σDno=5(EMPLOYEE)
RESULT ← πFname, Lname, Salary(DEP5_EMPS)
TEMP ← σDno=5(EMPLOYEE)
R(First_name, Last_name, Salary) ← πFname, Lname, Salary(TEMP)
In relational algebra, the division operator (denoted as ÷) is used to find tuples in
one relation (table) that are associated with all tuples in another relation.
e.g. We want to find the SSNs of employees who are assigned to all the
projects that Smith is assigned to.
• a list of all the projects that Smith is assigned to.
• need to find employees who are assigned to every one of those projects.
one". It asserts that at least one element in a given set or domain satisfies a
particular property.
Practice Questions
Practice Questions
Practice Questions
Practice Questions
Practice Questions
Practice Questions
Practice Questions
Practice Questions : solve by yourself. Solutions given here may not be correct.
Practice Questions
Practice Questions
THANK YOU