Question: State the SQL code for the following statements 1. Retrieve the salary of every employee 2. Retrieve the total number of employees in the company.

State the SQL code for the following statements


1.  Retrieve the salary of every employee
2. Retrieve the total number of employees in the company.
3. Retrieve the total number of employees in the Software department and salary is more than 50,000.
4. Retrieve a list of employees and the projects they are working on, ordered by department and, within each department, ordered alphabetically by last name, first name
5. For every project located in 'Houston', retrieve project number, department number and department manger first name and date of birth.


 

12345678 create database Company; CREATE TABLE Company.employee (fname 5 minit 1name 7 varchar(15) not null, varchar(1), varchar(15) not null, char(9), date, varchar(50), ssn bdate 9 address 10 sex 11 salary 12 superssn char(9), 17 (dname 18 dnumber mgrssn char, decimal(10,2), 13 dno 14 primary key (ssn)); 15 integer (4), 16 CREATE TABLE Company.department varchar(25) not null, integer (4), char(9) not null, 19 20 mgrstartdate date, 21 primary key (dnumber), 22 unique (dname), 23 foreign key (mgrssn) references Company.employee(ssn)); 24 25 CREATE TABLE Company.dept_locations ( dnumber integer(4), dlocation varchar(15), primary key (dnumber,dlocation), 26 foreign key (dnumber) references Company.department (dnumber)); 27 28 CREATE TABLE Company.project ( pname varchar(25) not null, pnumber integer(4), plocation varchar(15), dnum 29 integer (4) not null, primary key (pnumber), unique (pname), foreign key (dnum) references Company.department (dnumber)); 30 31 CREATE TABLE Company.works_on ( essn char(9), pno integer(4), hours decimal(4,1), primary key (essn, pno), 32 foreign key (essn) references Company.employee(ssn), foreign key (pno) references Company.project (pnumber)); 33 34 CREATE TABLE Company.dependent ( essn char(9), dependent_name varchar(15), sex char, bdate 35 relationship varchar(8), primary key (essn, dependent_name), foreign key (essn) references Company.employee(ssn)); date,

Step by Step Solution

3.54 Rating (147 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is the SQL code for the given statements 1 Retrieve the salary of every employee sql SELECT sal... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!

Related Book