MySql Workbench 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 ); 1. List last name of all students whose first name is longer than 4 letters in ascending order according to the last name. Duplicated rows should be removed from the output. 2. Count the total number of rooms in Location. 3. Find the number of students in each major.

Oracle 12c: SQL
3rd Edition
ISBN:9781305251038
Author:Joan Casteel
Publisher:Joan Casteel
Chapter6: Additional Database Objects
Section: Chapter Questions
Problem 6HOA: A new table has been requested to support tracking automated emails sent to customers. Create the...
icon
Related questions
icon
Concept explainers
Question

 MySql Workbench

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
);

1. List last name of all students whose first name is longer than 4 letters in ascending order according
to the last name. Duplicated rows should be removed from the output.
2. Count the total number of rooms in Location.
3. Find the number of students in each major.
4. Find the number of employees in each department who get no commission or have salary less than
5000.
5. Find the maximum salary of employees in each department that the employee was hired 15 years
before now. *hint: user TIMESTAMPDIFF(<unit type>,<Date_value 1>,<Date_value 2>), the unit
can be YEAR, MONTH, DAY, HOUR, etc...

Expert Solution
steps

Step by step

Solved in 5 steps with 9 images

Blurred answer
Knowledge Booster
Query Syntax
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage