Professional Documents
Culture Documents
Advance Database Management System
Advance Database Management System
System
Subject code:22CAP605
Student name: Tarun Saraswat.
UID:22MCA20528
Section/Group:1/A
Experiment no. 2
Experiment 1.2
You are given three tables: Students, Friends and Packages. Students contains two
columns: ID and Name. Friends contains two columns: ID and Friend_ID (ID of the ONLY best
friend). Packages contains two columns: ID and Salary (offered salary in $ thousands per month).
Write a query to output the names of those students whose best friends got offered a higher salary
than them. Names must be ordered by the salary amount offered to the best friends. It is guaranteed
that no two students got same salary offer.
Queries made:
mysql> create table students(id int, name varchar(30));
mysql> create table packages (id int, salary int);
mysql> create table friends (id int, friend_id int);
[To create the tables ]
mysql> insert into students values (1,'Mukul');
mysql> insert into students values (2,'Vishnu');
mysql> insert into students values (3,'Bhanu');
[To insert data in the table]
mysql> select* from students; [To show the table]
Screenshots of outputs:
Conclusion:
I learned about creating Database, creating tables in the database, Defining
different columns in the tables, showing the table of the database by making
some quarries, using inner join and sub query and filtering the data according to
the required conditions from different tables.