If we were to create the following database, there are specific commands that are needed to generate a SQL Query. Review the information and answer the questions.
CREATE DATABASE ORG;
SHOW DATABASES;
USE ORG;
CREATE TABLE Worker (
WORKER_ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
FIRST_NAME CHAR(25),
LAST_NAME CHAR(25),
SALARY INT(15),
JOINING_DATE DATETIME,
DEPARTMENT CHAR(25)
);
INSERT INTO Worker
(WORKER_ID, FIRST_NAME, LAST_NAME, SALARY, JOINING_DATE, DEPARTMENT) VALUES
(001, ‘Monika’, ‘Stevens’, 100000, ’14-02-20 09.00.00′, ‘HR’),
(002, ‘Nic’, ‘Verma’, 80000, ’14-06-11 09.00.00′, ‘Admin’),
(003, ‘Steven’, ‘Farcie’, 300000, ’14-02-20 09.00.00′, ‘Accounting’),
(004, ‘Marisa’, ‘Singh’, 500000, ’11-02-20 09.00.00′, ‘Executive’),
(005, ‘Vivek’, ‘Bart’, 500000, ’14-06-12 09.00.00′, ‘Admin’),
(006, ‘JR’, ‘Diwan’, 200000, ’14-06-11 09.00.00′, ‘Executive’),
(007, ‘MJ’, ‘Crocket’, 75000, ’14-01-20 09.00.00′, ‘Account’),
(008, ‘Thomas’, ‘Ebert’, 90000, ’14-04-11 09.00.00′, ‘Admin’);
(009, ‘George’, ‘Smith’, 73500, ’12-05-22 09.00.00’, ‘IT’);
(010, ‘Tom’, ‘George’, 125000, ’13-06-19 09.00.00’, ‘IT’);
(011, ‘Jerry’, ‘Crooke’, 65400, ’14-07-18 09.00.00’, ‘Training’);
(012, ‘Miguel’, ‘Sanchez’, 185000, ’15-08-17 09.00.00’, ‘Facility’);
Q-1. Write an SQL query to show the top n (say 8) records of a table. To complete the answer, execute the query and insert a full-screen snapshot with the query.
Q-2. Write an SQL query to fetch the last seven records from a table. To complete the answer, execute the query and insert a full-screen snapshot with the query.
Q-3. Write an SQL query to fetch nth max salaries from a table. To complete the answer, execute the query and insert a full-screen snapshot with the query.