LB Dbms
LB Dbms
SN Title Signature
MY SQL
MySQL, standing for "My Structured Query Language," is a
powerful and widely-used open-source relational database
management system (RDBMS). It's a cornerstone technology for
building and managing databases, the backbone of many web
applications and software systems.
Advantages of MySQL:
o Open-source and Free
o Easy to Learn
o Scalable
o Large Community
Disadvantages of MySQL:
o Limited Functionality
EMPLOYEE DATABASE:
Consider the schema for Company Database:
EMPLOYEE(SSN, Name, Address, Sex, Salary, SuperSSN, DNo)
DEPARTMENT(DNo, DName, MgrSSN, MgrStartDate)
DLOCATION(DNo,DLoc)
PROJECT(PNo, PName, PLocation, DNo)
WORKS_ON(SSN, PNo, Hours)
Write SQL queries to :
1. Make a list of all project numbers for projects that involve an employee
whose last name is ‘Scott’, either as a worker or as a manager of the
department that controls the project.
2. Show the resulting salaries if every employee working on the ‘IoT’ project
is given a 10 percent raise.
3. Find the sum of the salaries of all employees of the ‘Accounts’
department, as well as the maximum salary, the minimum salary, and the
average salary in this department.
4. Retrieve the name of each employee who works on all the projects
controlled by department number 5 (use NOT EXISTS operator).
CREATING AND USING DATABASE
CREATING TABLES
INSERTING DATA INTO TABLE :
USING SELECT QUERY TO VIEW THE VALUES IN THE TABLE
b. Find the name and numbers of all salesman who had more than one
customer.
c. List all the salesman and indicate those who have and do not have
customers in their cities (Use UNION operation.)
d. Create a view that finds the salesman who has the customer with the
highest order of a day.
CREATING TABLES
INSERTING DATA INTO TABLE :
USING SELLECT QUERY TO VIEW THE VALUES IN
THE TABLE
C. List all the salesman and indicate those who have and do
not have customers in their cities (Use UNION operation.)
D. Create a view that finds the salesman who has the
customer with the highest order of a day.
RATING(Mov_id, Rev_Stars)
2. Find the movie names where one or more actors acted in two or
more movies.
3. List all actors who acted in a movie before 2000 and in a movie after
2015 (use JOIN operation).
4. Find the title of movies and number of stars for each movie that has
at least one rating and find the highest number of stars that movie
received. Sort the result by movie title.
CREATING TABLE:
INSERTING DATA INTO TABLES
USING SELLECT QUERY TO VIEW THE VALUES IN THE
TABLE
FOR TABLE ACTOR:
2. Find the movie names where one or more actors acted in two or
more movies.
3. List all actors who acted in a movie before 2000 and in a movie
after 2015 (use JOIN operation).
4. Find the title of movies and number of stars for each movie
that has at least one rating and find the highest number of stars
that movie received. Sort the result by movie title.
5. Update rating of all movies directed by ‘Steven Spielberg’ to 5
LAB 4 :
5. Calculate the FinalIA (average of best two test marks) and update
the corresponding table for all students.
CREATING DATABASE:
CREATING TABLES:
INSERTING DATA INTO TA TABLES
USING SELLECT QUERY TO VIEW THE TABLE:
FOR TABLE STUDENTS