Concept explainers
This question is based on the following data and tables. Create a
-- Authors Table CREATE TABLE authors (
author_id INT PRIMARY KEY AUTO_INCREMENT, author_name VARCHAR(255) NOT NULL, birth_year INT
);
-- Sample Data
INSERT INTO authors (author_name, birth_year) VALUES ('J.K. Rowling', 1965),
('George Orwell', 1903),
('Jane Austen', 1775);
-- Books Table CREATE TABLE books (
book_id INT PRIMARY KEY AUTO_INCREMENT, title VARCHAR(255) NOT NULL, publication_year INT,
author_id INT,
FOREIGN KEY (author_id) REFERENCES authors(author_id) );
-- Sample Data
INSERT INTO books (title, publication_year, author_id) VALUES ('Harry Potter and the Sorcerer''s Stone', 1997, 1),
('1984', 1949, 2),
('Pride and Prejudice', 1813, 3);
-
a- Write a MySQL query that selects the author with the earliest birth year.
-
b- WriteaMySQLquerythatwillfindthetitlesofbookspublishedaftertheyear1900from
the books table.
-
c- Write a MySQL query that utilizes a join to retrieve the names of authors and the titles
of their books (if any) from the authors and books tables.
-
d- WriteaMySQLquerythatwillcalculatetheaveragebirthyearforallauthors.
-
e- Write a MySQL query that will count the number of books written by each author.
Include the author's name and the count of books. Show authors even if they have written zero books.
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images
Can I get a screen shot for each querirs
Can I get a screen shot for each querirs
- Please written by computer sourcearrow_forwardColumn name Datatype Description trainer_id Should increment what is the datatype and size?arrow_forwardTask 3: The InstantRide Finance team wants to collect the price and discount information with the driver names for each travel in the system. You need to return the TRAVEL_ID, DRIVER_FIRST_NAME, DRIVER_LAST_NAME, TRAVEL_PRICE, and TRAVEL_DISCOUNT information from the TRAVELS and DRIVERS tables combined over DRIVER_ID field with the ON keyword. Task: Calculate each user's price and discount information. (SQL Database Test)arrow_forward
- help please Create a table named BRANCH. The table has the following structureBRANCH_NUM decimal(2,0) NOT NULL default '0'BRANCH_NAME char(50) default NULLBRANCH_LOCATION char(50) default NULLNUM_EMPLOYEES decimal(2,0) deault NULL PRIMARY KEY (`BRANCH_NUM`) (Please type answer no write by hand)arrow_forwardMySQL CREATE TABLE students ( id INT PRIMARY KEY, first_name VARCHAR(50), last_name VARCHAR(50), age INT, major VARCHAR(50), faculty VARCHAR(50)); CREATE TABLE location ( id INT PRIMARY KEY, name VARCHAR(50), rooms INT); CREATE TABLE faculty ( id INT PRIMARY KEY, name VARCHAR(50), department_id INT); 4. Find the number of employees in each department who get no commission or have salary less than5000.5. Find the maximum salary of employees in each department that the employee was hired 15 yearsbefore now. *hint: user TIMESTAMPDIFF(<unit type>,<Date_value 1>,<Date_value 2>), the unitcan be YEAR, MONTH, DAY, HOUR, etc...6. Find the last name of all employees that were not hired on Tuesday *hint: (UseDATE_FORMAT() function amd the format you need is %W, also use UPPER()7. Find the number of employees in each department who have a manager.8. Find the number of employees for each manager whose employees' minimum salary is greaterthan 5000.9. Find the number of…arrow_forwardInstructorld 1 • Courseld CourseCode 9630 MATH109 Course CourseName Linear Algebra Capacity 175 4964 PHILAT Intro to Philosophy 50 4253 MATH19 Number Theory 150 1896 HIST66 American History 25 8048 HIST58 World History 125 2133 Instructor Instructorld InstructorName Rank Department Del Day Associate Professor Math Rob Ruiz Associate Professor Philosophy Aya Diaz Associate Professor History Note: Both tables may not be necessary to complete this level. Select the rows returned by the query below. SELECT CourseName, Capacity, InstructorId FROM Course C WHERE Capacity > (SELECT AVG (Capacity) FROM Course WHERE InstructorId = c.InstructorId); CourseName Linear Algebra Capacity Instructorld 175 1 Intro to Philosophy 50 2 150 Number Theory American History 25 World History 125 2133arrow_forward
- Guided Table Build: We will be Creating a Table called Student For the 6 following questions, your submission will be the query that shows you’ve created the table conforming to the requirements. Create a Table Named Student. The first column should be named ID, and have a data type of Integer The second column should be named First_Name, and have a data type of varchar(255). The third column should be named Last_Name, and have a data type of varchar(255) The fourth column should be named DOB (short for date of birth), and have a data type of date. The firth column should be named Adv_ID (short for advisor ID), and have a data type of integer.arrow_forwardcreate tables appointments having columns appointment id as primary key, appointment time, appointment date, doctor id doctors having doctor id as primary key, doctor name providers having provider id as primary key, provider first name, last name, username, password, office code. Now create a provider first name as Lilly , Last name as Brooks, username as Lily_777, password as Brooks_666. Validate on the database also show me the appointments with Dr.Alex at 10.30A.Marrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education