Do you need this or any other assignment done for you from scratch?
We have qualified writers to help you.
We assure you a quality paper that is 100% free from plagiarism and AI.
You can choose either format of your choice ( Apa, Mla, Havard, Chicago, or any other)
NB: We do not resell your papers. Upon ordering, we do an original paper exclusively for you.
NB: All your data is kept safe from the public.
Q1) Write a SQL query to fetch all the duplicate records from applicants table.
Q1) Write a SQL query to fetch all the duplicate records from applicants table.
/**Tables Structure:**/
drop table applicants;
create table applicants
(
user_id int primary key,
user_name varchar(30) not null,
email varchar(50));
REPLACE INTO users values
(1, ‘pearson’, ‘pearson@gmail.com’),
(2, ‘Reshma’, ‘reshma@gmail.com’),
(3, ‘Farhana’, ‘farhana@gmail.com’),
(4, ‘Robin’, ‘robin@gmail.com’),
(5, ‘Robin’, ‘robin@gmail.com’);
select * from applicants;
Q2) Create a SQL query to retrieve the employee table’s second-to-last record.
–Tables Structure:
drop table employee;
create table employee
( emp_ID int primary key
, emp_NAME varchar(50) not null
, DEPT_NAME varchar(50)
, SALARY int);
REPLACE INTO employee values(101, ‘Mohan’, ‘Admin’, 4000);
REPLACE INTO employee values(102, ‘Rajkumar’, ‘HR’, 3000);
REPLACE INTO employee values(103, ‘Akbar’, ‘IT’, 4000);
REPLACE INTO employee values(104, ‘Dorvin’, ‘Finance’, 6500);
REPLACE INTO employee values(105, ‘Rohit’, ‘HR’, 3000);
REPLACE INTO employee values(106, ‘Rajesh’,’Finance’, 5000);
REPLACE INTO employee values(107, ‘Preet’, ‘HR’, 7000);
REPLACE INTO employee values(108, ‘Maryam’, ‘Admin’, 4000);
REPLACE INTO employee values(109, ‘Sanjay’, ‘IT’, 6500);
REPLACE INTO employee values(110, ‘Vasudha’, ‘IT’, 7000);
REPLACE INTO employee values(111, ‘Melinda’, ‘IT’, 8000);
REPLACE INTO employee values(112, ‘Komal’, ‘IT’, 10000);
REPLACE INTO employee values(113, ‘Gautham’, ‘Admin’, 2000);
REPLACE INTO employee values(114, ‘Manisha’, ‘HR’, 3000);
REPLACE INTO employee values(115, ‘Chandni’, ‘IT’, 4500);
REPLACE INTO employee values(116, ‘Satya’, ‘Finance’, 6500);
REPLACE INTO employee values(117, ‘Adarsh’, ‘HR’, 3500);
REPLACE INTO employee values(118, ‘Tejaswi’, ‘Finance’, 5500);
REPLACE INTO employee values(119, ‘Cory’, ‘HR’, 8000);
REPLACE INTO employee values(120, ‘Monica’, ‘Admin’, 5000);
REPLACE INTO employee values(121, ‘Rosalin’, ‘IT’, 6000);
REPLACE INTO employee values(122, ‘Ibrahim’, ‘IT’, 8000);
REPLACE INTO employee values(123, ‘Vikram’, ‘IT’, 8000);
REPLACE INTO employee values(124, ‘Dheeraj’, ‘IT’, 11000);
select * from employee;
Required Output: Vikram
Create a SQL query to only show the employee table’s information for those with the only highest or lowest salaries across all departments.
–Tables Structure:
drop table employee;
create table employee
( emp_ID int primary key
, emp_NAME varchar(50) not null
, DEPT_NAME varchar(50)
, SALARY int);
REPLACE INTO employee values(101, ‘Mohan’, ‘Admin’, 4000);
REPLACE INTO employee values(102, ‘Rajkumar’, ‘HR’, 3000);
REPLACE INTO employee values(103, ‘Akbar’, ‘IT’, 4000);
REPLACE INTO employee values(104, ‘Dorvin’, ‘Finance’, 6500);
REPLACE INTO employee values(105, ‘Rohit’, ‘HR’, 3000);
REPLACE INTO employee values(106, ‘Rajesh’,’Finance’, 5000);
REPLACE INTO employee values(107, ‘Preet’, ‘HR’, 7000);
REPLACE INTO employee values(108, ‘Maryam’, ‘Admin’, 4000);
REPLACE INTO employee values(109, ‘Sanjay’, ‘IT’, 6500);
REPLACE INTO employee values(110, ‘Vasudha’, ‘IT’, 7000);
REPLACE INTO employee values(111, ‘Melinda’, ‘IT’, 8000);
REPLACE INTO employee values(112, ‘Komal’, ‘IT’, 10000);
REPLACE INTO employee values(113, ‘Gautham’, ‘Admin’, 2000);
REPLACE INTO employee values(114, ‘Manisha’, ‘HR’, 3000);
REPLACE INTO employee values(115, ‘Chandni’, ‘IT’, 4500);
REPLACE INTO employee values(116, ‘Satya’, ‘Finance’, 6500);
REPLACE INTO employee values(117, ‘Adarsh’, ‘HR’, 3500);
REPLACE INTO employee values(118, ‘Tejaswi’, ‘Finance’, 5500);
REPLACE INTO employee values(119, ‘Cory’, ‘HR’, 8000);
REPLACE INTO employee values(120, ‘Monica’, ‘Admin’, 5000);
REPLACE INTO employee values(121, ‘Rosalin’, ‘IT’, 6000);
REPLACE INTO employee values(122, ‘Ibrahim’, ‘IT’, 8000);
REPLACE INTO employee values(123, ‘Vikram’, ‘IT’, 8000);
REPLACE INTO employee values(124, ‘Dheeraj’, ‘IT’, 11000);
select * from employee;
Ex: Output: In Admit department
# emp_ID,emp_NAME,DEPT_NAME,SALARY ,max_salary,min_salary
113GauthamAdmin200050002000
120Monica Admin500050002000
Create a SQL query from the students table to swap the adjacent student names.
Note: The student name should remain the same if there are no adjacent students.
–Table Structure:
drop table students;
create table students
(
id int primary key,
student_name varchar(50) not null
);
REPLACE INTO students values
(1, ‘James’),
(2, ‘Michael’),
(3, ‘George’),
(4, ‘Stewart’),
(5, ‘Robin’);
select * from students;
Q7) Get all the instances where Alaska experienced extremely low temperatures for three or more straight days from the weather table.
Note: When the weather is below zero, it is deemed to be extremely cold.
–Table Structure:
drop table weather;
create table weather
(
id int,
city varchar(50),
temperature int,
day date
);
delete from weather;
REPLACE INTO weather values
(1, ‘Alaska’, -1, to_date(‘2021-01-01′,’yyyy-mm-dd’)),
(2, ‘Alaska’, -2, to_date(‘2021-01-02′,’yyyy-mm-dd’)),
(3, ‘Alaska’, 4, to_date(‘2021-01-03′,’yyyy-mm-dd’)),
(4, ‘Alaska’, 1, to_date(‘2021-01-04′,’yyyy-mm-dd’)),
(5, ‘Alaska’, -2, to_date(‘2021-01-05′,’yyyy-mm-dd’)),
(6, ‘Alaska’, -5, to_date(‘2021-01-06′,’yyyy-mm-dd’)),
(7, ‘Alaska’, -7, to_date(‘2021-01-07′,’yyyy-mm-dd’)),
(8, ‘Alaska’, 5, to_date(‘2021-01-08′,’yyyy-mm-dd’));
select * from weather;
Do you need this or any other assignment done for you from scratch?
We have qualified writers to help you.
We assure you a quality paper that is 100% free from plagiarism and AI.
You can choose either format of your choice ( Apa, Mla, Havard, Chicago, or any other)
NB: We do not resell your papers. Upon ordering, we do an original paper exclusively for you.
NB: All your data is kept safe from the public.
Place this order or similar order and get an amazing discount. USE Discount code “GET20” for 20% discount