Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CREATE TABLE person ( ID NUMBER, Name VARCHAR2 (20), Home VARCHAR2 (30), Age NUMBER (2), Occupation VARCHAR2 (45), Gender VARCHAR2 (6), Salary NUMBER, CONSTRAINTS PK_person

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

CREATE TABLE person ( ID NUMBER, Name VARCHAR2 (20), Home VARCHAR2 (30), Age NUMBER (2), Occupation VARCHAR2 (45), Gender VARCHAR2 (6), Salary NUMBER, CONSTRAINTS PK_person PRIMARY KEY (ID) CREATE TABLE Phone ( ID number, brand varchar2 (40), model varchar2 (49), screensize number); INSERT INTO person VALUES (1, aisha', 'Dhaka', 25, Teacher', 'Female', 50000); INSERT INTO person VALUES (2, 'Saad', 'Dhaka', 56, 'Service', 'Male', 60000); INSERT INTO person VALUES (3, 'Rakeen', 'ctg', 71, 'Retired', 'Male', 10000); INSERT INTO person VALUES (6, 'Ilma', 'Gazipur', 54, 'Doctor', 'Female', 55000); INSERT INTO person VALUES (7, 'Rajib', 'Gazipur', 65, 'Musician', 'Male', 5000); INSERT INTO person VALUES (8, 'Raisa', 'Dhaka', 56, 'Engineer', 'Female', 60000); INSERT INTO person VALUES (9, 'Sakib', 'ctg', 23, 'Student', 'Male', 1000); INSERT INTO person VALUES (10, 'Mosaddek', 'Comilla', 32, 'Teacher', 'Male', 45000); INSERT INTO person VALUES (11, 'Jarin', 'Comilla', 51, 'Farmer', 'Female', 20000); INSERT INTO person VALUES (12, 'Rudaba', 'Khulna', 15, 'Student', 'Female', 1500); INSERT INTO person VALUES (13, 'Sami', Ctg', 25, 'Business', 'Male', 100000); INSERT INTO person VALUES (14, 'Nihal', 'Comilla', 52, 'Doctor', 'Male', 70000); INSERT INTO person VALUES (15, 'Rafid', 'Gazipur', 53, 'Teacher', 'Male', 50000); INSERT INTO person VALUES (16, 'Medha', 'Dhaka', 35, 'Musician', 'Female', 50000); INSERT INTO person VALUES (17, 'Sakib', 'Khulna', 43, 'Service', 'Male', 50000); INSERT INTO person VALUES (18, 'Zobaeir', 'Khulna', 34, 'Service', 'Male', 45000); INSERT INTO person VALUES (19, 'Shahriyar', 'ctg', 16, 'Student', 'Male', 500); INSERT INTO person VALUES (20, 'Mahir', 'Comilla', 32, 'Business', 'Male', 120000); INSERT INTO person VALUES (21, 'Mushfiqur', 'ctg', 25, 'Musician', 'Male', 100000); INSERT INTO person VALUES (22, 'Najish', 'Gazipur', 14, 'Student', 'Male', 400); INSERT INTO person VALUES (23, 'Bandhan', 'Dhaka', 25, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (24, 'Shadman', 'ctg', 28, 'Teacher', 'Male', 80000); INSERT INTO person VALUES (25, 'Faria', 'Dhaka', 25, 'Engineer', 'Female', 50000); INSERT INTO person VALUES (26, 'Taki', 'Dhaka', 26, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (27, 'Tanzir', 'Dhaka', 45, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (28, 'Alvi', 'ctg', 23, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (29, 'Nasib', 'Dhaka', 21, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (30, 'Mim', 'Dhaka', 75, 'Teacher', 'Female', 40000); INSERT INTO person VALUES (31, 'Ornob', 'Dhaka', 43, Student', 'Male', 50000); INSERT INTO person VALUES (32, 'Shuvo', 'Dhaka', 2, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (33, 'Anika', 'Dhaka', 56, 'Engineer', 'Female', 50000); INSERT INTO person VALUES (34, 'Ikra', 'Ctg', 78, 'Teacher', 'Female', 50000); INSERT INTO person VALUES (35, 'ojhor', 'Dhaka', 12, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (36, 'Saadman', 'Dhaka', 32, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (37, 'Nafiz', 'Dhaka', 15, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (38, 'Arman', 'Dhaka', 55, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (39, 'Faysal', 'Dhaka', 23, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (40, 'Syed', 'Dhaka', 22, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (41, 'Abidure', 'Dhaka', 21, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (42, 'Nafisa', 'Dhaka', 24, 'Engineer', 'Female', 50000); INSERT INTO person VALUES (44, 'Abu', 'ctg', 25, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (45, 'Maruf', 'Dhaka', 26, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (46, 'Omar', 'Dhaka', 27, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (47, 'Mahdia', 'Dhaka', 28, 'Engineer', 'Female', 50000); INSERT INTO person VALUES (48, 'Nazneen', 'Dhaka', 29, 'Engineer', 'Female', 50000); INSERT INTO person VALUES (49, 'Ahikul', 'Dhaka', 30, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (50, 'Asif', 'Dhaka', 31, 'Musician', 'Male', 50000); INSERT INTO person VALUES (51, 'Abir', 'ctg', 32, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (52, 'Afrin', 'Dhaka', 22, 'Engineer', 'Female', 50000); INSERT INTO person VALUES (53, 'Evan', 'Dhaka', 78, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (55, 'Muhib', 'ctg', 66, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (56, 'Zizan', 'Dhaka', 90, 'Musician', 'Male', 40000); INSERT INTO person VALUES (57, 'Tansi', 'Dhaka', 44, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (58, 'Mumu', 'ctg', 87, 'Engineer', 'Female', 1000); INSERT INTO person VALUES (59, 'Elma', 'Dhaka', 25, 'Teacher', 'Female', 9000); INSERT INTO person VALUES (60, 'Emon', 'Dhaka', 33, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (61, 'Tanzil', 'Dhaka', 89, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (62, 'Nafi', 'Dhaka', 75, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (63, 'Azraf', 'ctg', 54, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (64, 'Istiaque', 'Dhaka', 44, 'Engineer', 'Male', 1000); INSERT INTO person VALUES (65, 'Ashraf', 'Dhaka', 32, 'Engineer', 'Male', 100); INSERT INTO person VALUES (66, 'Rubaiat', 'Dhaka', 45, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (67, 'Rafsan', 'Dhaka', 2, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (68, 'Preetu', 'Dhaka', 12, 'Engineer', 'Female', 50000); INSERT INTO person VALUES (69, 'Abdullah', 'Dhaka', 34, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (70, 'Shafi', 'Dhaka', 65, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (71, 'Nova', 'ctg', 25, 'Engineer', 'Female', 200); INSERT INTO person VALUES (72, 'Rokoni', 'Dhaka', 61, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (73, 'Alsaad', 'Dhaka', 40, 'Teacher', 'Male', 10000); INSERT INTO person VALUES (74, 'Muhtasim', 'Dhaka', 39, 'Engineer', 'Male', 3000); INSERT INTO person VALUES (75, 'Galib', 'Jashore', 34, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (76, 'Keya', 'Dhaka', 45, 'Engineer', 'Female', 50000); INSERT INTO person VALUES (77, 'Aunkon', 'Dhaka', 65, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (78, 'Sabbir', 'Dhaka', 53, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (80, 'Shams Shuvo', 'Dhaka', 21, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (81, 'Priota', 'Dhaka', 16, 'Engineer', 'Female', 50000); INSERT INTO person VALUES (82, 'Tameem', 'Comilla', 18, 'Engineer', 'Male', 50000); INSERT INTO person VALUES (83, 'Ibrahim', 'Dhaka', 19, 'Engineer', 'Male', 10); INSERT INTO Phone VALUES (1, Samsung', 'galaxy note 8', 4); INSERT INTO Phone VALUES (71, 'Xiaomi', 'Mi5', 6.5); INSERT INTO Phone VALUES (58, 'Apple', 'Iphone 8', 7.0); INSERT INTO Phone VALUES (51, 'Oneplus', 'three', 3); INSERT INTO Phone VALUES (44, 'Blackberry', 'X50', 6.0); INSERT INTO Phone VALUES (13, 'Samsung', 'galaxy s8', 7); INSERT INTO Phone VALUES (28, 'Huwaei', 'Honor 5', 6.1); Execute the the command given in "person.sql" file The sql file contains the necessary DDL statements to create and store values inside the table. The table is as follows: PERSON (ID, name, hometown, age, occupation, gender, salary) Phone (ID, brand, model, screensize) Now, execute the following queries: 1. Count the number of female persons. COUNT 20 2. What is the average age of people doing business? AVG_AGE 28.5 3. Show the list of persons where the occupation might be either Doctor or Teacher. ID NAME HOME AGE OCCUPATION GENDER SALARY 1 Maisha 6 Ilma 10 Mosaddek 14 Nihal 15 Rafid 24 Shadman 30 Mim 34 Ikra 59 Elma 73 Alsaad Dhaka Gazipur Comilla Comilla Gazipur Ctg Dhaka 25 Teacher 54 Doctor 32 Teacher 52 Doctor 53 Teacher 28 Teacher 75 Teacher 78 Teacher 25 Teacher 40 Teacher Female Female Male Male Male Male Female Female Female Male 50000 55080 45000 70000 50000 80080 40080 50000 9088 10000 Ctg Dhaka Dhaka 4. Make an ordered list of Teachers according to the salary. ID NAME HOME AGE OCCUPATION GENDER SALARY 59 Elma 73 Alsaad 30 Mim 10 Mosaddek 1 Maisha 15 Rafid 34 Ikra 24 Shadman Dhaka Dhaka Dhaka Comilla Dhaka Gazipur 25 Teacher 40 Teacher 75 Teacher 32 Teacher 25 Teacher 53 Teacher 78 Teacher 28 Teacher Female Male Female Male Female Male Female Male 9000 10000 40000 45000 50000 50000 50000 80000 Ctg Ctg 5. Make a descending ordered list based on the age and show the names and age only. If the age is same, sort in alphabetical order. (Result shows limited rows, there are more). NAME AGE 2 2 12 12 ANNNN Rafsan Shuvo ojhor Preetu Najish Nafiz Rudaba Priota Shahriyar Tameem Ibrahim Abidure Nasib 15 15 16 16 18 19 21 21 6. What is the total salary of all the Musicians of the table? Rename the total salary as TOTAL_SALARY TOT_SAL 245000

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions

Question

What styles do they use?

Answered: 1 week ago

Question

create a semiotic sign system to communicate an idea.

Answered: 1 week ago

Question

apply research strategies to writing.

Answered: 1 week ago