Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

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

Step: 1

Here is the SQL code for the given statements 1 Retrieve the salary of every employee sql SELECT sal... blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students explore these related Databases questions

Question

=+\List four elements of promotion.

Answered: 3 weeks ago