You are on page 1of 5

Assignment (Friday): DBMS

Subject: Handling Information Through Data Modeling & Design


Subject Code: - 32863103
Roll No.- 12040
Name- Prateek Yadav

Q1. What is the use of SQL and Non-SQL databases? When to use which one?
Specify with scenarios?

A1. The preference among SQL and NoSQL relies upon completely on character situations as
each of them has blessings in addition to disadvantages. SQL databases are long-set up with a
hard and fast schema layout and a fixed structure. They are perfect for packages that require
multi-row transactions which include an accounting machine or for legacy structures that had
been constructed for a relational structure.

On the opposite hand, NoSQL databases are effortlessly scalable, flexible, and easy to apply
as they haven't any inflexible schema. They are perfect for packages without unique schema
definitions which include content material control structures, huge statistics packages, real-
time analytics, etc.

SQL is the finest database to employ for relational data, notably when the link among data sets is
easily understandable and accessible. It’s also the greatest way to check for data security and
integrity. SQL enables rising ad-hoc queries, and, in most circumstances, SQL databases are
vertically expandable if you require flexibility in data access.
Use Cases SQL-

• SQL is the simplest language used for interacting with a relational database management
system.
• Understanding and modifying behavioural-related programs
• Creating unique dashboards

Use Cases no-SQL-

• Data that necessitates a flexible schema


• When ACID assistance isn’t required
• Data logging from a variety of sources
Q2.

Query 1: For every project located in “Safford” list pno, compolting dno, dept
manager name.
Answer 1: - SELECT pno, dno, fname
From Employee as emp, Department as dept, Project as prjt, Works_on as
wrks
Where emp.sssn=mgrssn
And emp.sssn=wks=.essn
And emp.ssn=dept.essn
And prjt.plocation= “%Safford”

Query 2: Count no. of employee in each dept in form of dname and


count.
Answer 2: SELECT dname , count(fname)
From Employee as emp, Works_on as wks, Department as dept
Where emp.sssn=wks=.essn
And emp.ssn=depndt.essn
And wks. HRS>10
Query 3: Display employee names who are working more than 10
hrs.
Answer 3: SELECT fname, name,lname
From Employee as emp, Dependent as depndt, Works_on as wrks
Where emp.ssn=depndt.essn
And WRK.HRS>10

Query 4: Select query to find out project no. that involve an employee with the
name “SMITH” as worker.
Answer 4: SELECT pnumber
From Employee as emp, Project as prjt, Works_on as wrks
Where emp.fname= “%smith”
And wrks.pno=prjt.pnumber
And wrks.essn=emp.sssn

Query 5: All the project no. of the department which is managed by


"smith".
Answer 5: SELECT pnumber
From Employee as emp, Department as dept, Project as prjt, Works_on as
wrks
Where emp.sssn=dept.mgrssn
And wrks.pno=prjt.pnumber
And wrks.essn=emp.sssn
And emp.fname= “%smith”

Query 6: List of all project no. Where employe smith working both as worker
and manager.
Answer 6: SELECT pnumber
From Employee as emp, Department as dept, Project as prjt, Works_on as
wrks
Where emp.sssn=dept.mgrssn
And dept.dname in ( “worker”, “manager”)

Query 7: Name an employee who has more than 2


departments.
Answer 7: SELECT fname, mname, lname
From Employee as emp, Department as dept
Where emp.sssn=dept.mgrssn
Q3. A database is being constructed to keep track of the teams and games of a sports
league. A team has a number of players, not all of whom participate in each game. It is
desired to keep track of the players participating in each game for each team, the
positions they played in that game, and the result of the game. Design an ER schema
diagram for this application, stating any assumptions you make. Choose your favorite
sport (e.g., soccer, baseball, football).

A3.
Q4. Consider the relation R, which has attributes that hold
schedules of courses and sections at a university; R = {Course_no,
Sec_no, Offering_dept, Credit_hours, Course_level, Instructor_ssn,
Semester, Year, Days_hours, Room_no, No_of_students}.
Suppose that the following functional dependencies hold on R: {Course_no} →
{Offering_dept, Credit_hours, Course_level} {Course_no, Sec_no, Semester, Year} →
{Days_hours, Room_no, No_of_students, Instructor_ssn} {Room_no, Days_hours,
Semester, Year} → {Instructor_ssn, Course_no, Sec_no}.
Try to determine which sets of attributes form keys of R. How would you normalize this
relation?

A4.

You might also like