Assignments(1,2,3)-1
Assignments(1,2,3)-1
3) List the type of database users. Explain their characteristics in brief, how they
interact with DBMS?
• End Users: People who use applications to interact with the database, often without
directly knowing the database itself.
• Application Programmers: Developers who write software that interacts with the
database.
• DBAs (Database Administrators): People responsible for managing the database.
• System Analysts: Professionals who analyze user needs and help design databases to
meet those needs.
• Sophisticated Users: Users who write complex queries and interact directly with the
database.
• Database Designers: People who define the structure of the database.
4) State the advantages of Database management systems over file processing system
• Less Data Redundancy: Less duplicate data.
• Better Data Integrity: Ensures data is accurate and consistent.
• Improved Data Security: Better control over who can see or change data.
• Data Independence: Changes to data storage do not affect how data is used.
• Efficient Data Access: Faster and more efficient data retrieval.
• Backup and Recovery: Easier to back up and restore data.
• Concurrent Access: Supports multiple users accessing data at the same time without
conflict.
5) Explain database system 3 tier architecture with clear diagram in detail.
+------------------+
| Presentation Tier|
| (User Interface) |
+------------------+
|
|
+------------------+
| Application Tier |
| (Logic & Process)|
+------------------+
|
|
+------------------+
| Data Tier |
| (Data Storage) |
+------------------+
1. Explain super key, candidate key, primary key and foreign key.
1. Keys in a Database
• Super Key:
A super key is any combination of attributes that uniquely identifies a row in a table.
A super key can have redundant attributes. For example, in a table Employee(eno,
ename, salary), both eno and (eno, ename) are super keys because they uniquely
identify a record.
• Candidate Key:
A candidate key is a minimal super key, meaning it has no redundant attributes. It
uniquely identifies a row in a table. In the example Employee(eno, ename, salary),
eno is a candidate key because it is minimal and uniquely identifies a row.
• Primary Key:
A primary key is a candidate key that is chosen by the database designer to uniquely
identify rows in a table. It cannot have NULL values. In Employee(eno, ename,
salary), eno can be chosen as the primary key.
• Foreign Key:
A foreign key is an attribute or a set of attributes in one table that references the
primary key of another table, establishing a relationship between the two tables. For
example, if there is another table Department(dno, dname, eno), eno in Department
could be a foreign key that references eno in Employee.
8. Write Relational Algebra syntax for the given queries using the following database.
Employee(eno,ename,salary,designation)
Customer(cno,cname,address,city)
a. Find out name of employees who are also customers.
π ename (Employee) ∩ π cname (Customer)
b. Find out name of person who are employees but not customers.
π ename (Employee) - π cname (Customer)
c. Display all names who are either employees or customers.
π ename (Employee) ∪ π cname (Customer)
9. Consider the relational database given below. Give an expression in the relational
algebra to express each of the following queries:
Employee (person-name, street, city),
Works (person-name, company-name, salary),
Company (company-name, city),
Manages (person-name, manager-name)
a. Find name of all employees.
π person-name (Employee)
c. Find name and city of all employees who are having salary>50000.
π person-name, city (σ salary > 50000 (Employee ⨝ Works))
d. Find total salary of all employees who are working for compa ny ‘HCL’.
SUM (π salary (σ company-name = 'HCL' (Works)))
10. Consider the following relational database schema consisting of thefour relation
schemas:
passenger ( pid, pname, pgender, pcity)
agency ( aid, aname, acity)
flight (fid, fdate, time, src, dest)
booking (pid, aid, fid, fdate)
Answer the following questions using relational algebra queries.
a. Get the details about all flights from Chennai to New Delhi.
σ src = 'Chennai' ∧ dest = 'New Delhi' (flight)