Question:
create table MYEMPLOYEES?
kemenyston
2007-06-01 15:33:49 UTC
You have just started a new company. It is time to hire some employees. You will need to
create a table that will contain the following information about your new employees:
employee_id, firstname, lastname, title, age, and salary.

A. create table MYEMPLOYEES having fields :

employee_id 3 character size,
firstname 30 characters max size,
lastname 30 characters max size,
title 30 characters max size,
age numeric value,
salary capability to store six-figure salary
with 2 decimal places.

It is time to insert data into your new employee table.

Your first three employees are the following:

234, Jonie, Weber, Secretary, 28, 19500.00
456, Potsy, Weber, Programmer, 32, 45300.00
789, Dirk, Smith, Programmer II, 45, 75020.00

Write appropriate sql statements to insert the above data.

B. Now add additional 12 Employees to this table.
(Add your own 'dummy' data keeping in mind the table structure)


Now, answer the following questions using SQL statements:


1) List all the employees (all fileds).
2) List of employee names (first and last) making more than $30000.
3) List of employees names (first and last) less than 30 yrs old.
4) Select first name, last name, and salary for anyone with "Programmer" in their title.
5) Show employee data (all fields) for employees whose last name contains "ebe".
6) Jonie Weber just got married to Dirk Smith. She has requested that her last name be
updated to 'Weber-Williams'. Make this change using SQL statement.
7) Bonus time ! Everyone that's making under $30000 are to receive a 3500 a year raise.
Make this change using SQL statement.
8) Jonie Weber-Williams just quit, remove her record from the table.
Make this change using SQL statement.
9) It's time for budget cuts. Remove all employees who are making over 70000 dollars.
Make this change using SQL statement.
10) Add the 'Hire_date' column to the MYEMPLOYEES table.
Three answers:
Me
2007-06-01 15:50:39 UTC
1) SELECT * FROM EMPLYEES

2) SELECT Firstname, Lastname FROM MYEMPLOYEES WHERE salary > 30000

3) SELECT Firstname, Lastname FROM MYEMPLOYEES WHERE age < 30

4) SELECT Firstname, Lastname, Salary FROM MYEMPLOYEES WHERE title LIKE '%Programmer%'

5) SELECT * FROM MYEMPLOYEES WHERE Lastname Like '%abe%'

6) UPDATE MYEMPLOYEES SET Lastname='Weber-Williams' WHERE employee_id=234

7) UPDATE MYEMPLOYEES SET salary = salary + 3500 WHERE salary < 30000

8) DELETE FROM MYEMPLYEES WHERE employee_id=234

9)DELETE FROM MYEMPLYEES WHERE salary > 70000

10) ALTER TABLE MYEMPLYEES ADD COLUMN Hire_Date DateTime
redhighheelsneakers_
2007-06-01 15:42:03 UTC
Tell me what is my pay and I'll get started. lol
Miss Battery
2007-06-01 15:37:12 UTC
Do your ow n homework.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...