Related questions
Concept explainers
SQL ( ORACLE SQL DEVELOPER ) :
THIS IS FIRST , SECOND AND THIRD TABLE for the Task 1 to solve :
create table author_45(
auth_name char(50),
gender char(1),
age number(3),
nationality char(50),
PRIMARY KEY (auth_name)
);
create table book_45(
isbn number(10),
title char(50),
ver_no number(2),
publisher char(50),
PRIMARY KEY (isbn)
);
create table writtenBy_45(
isbn number(10),
auth_name char(50),
yr_published number(4),
price number(3),
no_copy number(4),
PRIMARY KEY (isbn,auth_name),
foreign key (isbn) references book_45,
foreign key (auth_name) references author_45
);
insert into author_45 values ('Benoit','F',42,'French');
insert into author_ 45 values ('Antonini','M',33,'Italian');
insert into author_ 45 values ('McAven','F',31,'Australian');
insert into author_ 45 values ('Williams','M',90,'British');
insert into book_45 values (101,'atabases',1,'Possum');
insert into book_45 values (202,'SQL Primer',2,'Hall');
insert into book_45 values (246,'
insert into book_45 values (500,'Informatics',4,'Hall');
insert into writtenby_45 values (101,'Benoit',1983,100,100);
insert into writtenby_45 values (246,'Williams',2000,200,120);
insert into writtenby_45 values (500,'McAven',2002,150,90);
insert into writtenby_45 values (202,'McAven',2005,300,4);
NOW :
TASK 1 :
Write a function to display appropriate message for a given book based on the criteria given below:
- if (price <= 50) then ‘Cheap’
- if (price> 50 and price <=100) then ‘Affordable’
- if (price > 100 and price <= 150) then ‘Expensive’
- else ‘Extravagant’
Step by stepSolved in 2 steps
- SQL Table: CREATE TABLE employees ( employee_id INT PRIMARY KEY, first_name VARCHAR(255), last_name VARCHAR(255), email VARCHAR(255) UNIQUE, phone_number VARCHAR(255), hire_date DATE, job_id VARCHAR(255), salary DECIMAL(10,2), commission_pct DECIMAL(5,2), manager_id INT, department_id INT, FOREIGN KEY (manager_id) REFERENCES employees(employee_id), FOREIGN KEY (department_id) REFERENCES departments(department_id)); CREATE TABLE departments ( department_id INT PRIMARY KEY, department_name VARCHAR(255), manager_id INT, FOREIGN KEY (manager_id) REFERENCES employees(employee_id)); INSERT INTO employees (employee_id, first_name, last_name, email, phone_number, hire_date, job_id, salary, commission_pct, manager_id, department_id)VALUES (1, 'John', 'Doe', 'john.doe@example.com', '555-555-5555', '2022-01-01', 'IT_PROG', 8000, 0.2, 3, 10), (2, 'Jane', 'Smith', 'jane.smith@example.com', '555-555-5556', '2022-02-01', 'IT_PROG', 9000,...arrow_forwardNeed help writing SQL queries for sample data basearrow_forwardCREATE TABLE Employee( firstName char(30) , lastName char(30) , hireDate date ,empNo int , empInitial char(30) , years int ); Write the SQL syntax to create an insert statement for the employee table you created above.arrow_forward
- How do you compose a subquery in SQL where you are searching for the most common value in one column for a specific value from another column (i.e. looking for the down where most penalties occur --> down is a column and PlayType is a column with penalties as a value). The columns are in the same table.arrow_forwardNeed help writing SQL queries for sample data basearrow_forwardUsing DML SQL, write the appropriate SQL query for each of the following:a) Insert A new customer with the following information:(Name: Ali, SSN: 1111, Address: Riyadh, Phone: 05555)b) Delete all the loans for customer with SSN: 2222c) Select all customer who got loans more than 250000 SAR, print the customers SSN, named) Print all the Accounts in Bank: ALBILAD and in branch no: 5arrow_forward
- Write SQL CODE List the Professor's First (EMP_FNAME) and Last names (EMP_LNAME) of those who teach more than 2 classes (CLASS table). Use Noncorrelated Subquery with INNER JOIN.arrow_forwardhelp with sql class Report the names of the professors who work on the most number of projectsarrow_forwardWrite a SQL code that returns the name of aircraft (MOD_NAME in MODEL table), number of trips each mode flied (based on the CHARTER table, name this Trip_Num), and Total distance of each mode (based on the CHARTER table, name this Total_Distance).arrow_forward
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education