1. Display the query you would write to update the salary for John Jones |
2. Display the query you would write to update all salaries by 5% |
3. Display the query you would write to update all salaries by 5% for only the employees who live in Arizona |
4. Write a query to insert a new record into the empinfo table (Hint: you are adding a full record - a new piece of information for each field/column) |
5. Write a query to add a new record into the empinfo table - BUT, you only have the employee's first and last names along with their age at this point. |
Sample Table: empinfo | |||||
first | last | id | age | city | state |
John | Jones | 99980 | 45 | Payson | Arizona |
Mary | Jones | 99982 | 25 | Payson | Arizona |
Eric | Edwards | 88232 | 32 | San Diego | California |
Mary Ann | Edwards | 88233 | 32 | Phoenix | Arizona |
Ginger | Howell | 98002 | 42 | Cottonwood | Arizona |
Sebastian | Smith | 92001 | 23 | Gila Bend | Arizona |
Gus | Gray | 22322 | 35 | Bagdad | Arizona |
Mary Ann | May | 32326 | 52 | Tucson | Arizona |
Erica | Williams | 32327 | 60 | Show Low | Arizona |
Leroy | Brown | 32380 | 22 | Pinetop | Arizona |
Elroy | Cleaver | 32382 | 22 | Globe | Arizona |
Sample Table: empsal | |||||
id | suprvsr | salary | bonus | bonus amt | office |
99980 | 92001 | 45600 | Y | 3000 | Arizona |
99982 | 92001 | 47000 | Y | 3000 | Arizona |
88232 | 92001 | 52500 | N | California | |
88233 | 92001 | 49300 | Y | 3000 | Arizona |
98002 | 92001 | 52200 | Y | 3000 | Arizona |
92001 | 88888 | 65000 | Y | 5000 | California |
22322 | 32380 | 46800 | Y | 3000 | Arizona |
32326 | 32380 | 50900 | N | Arizona | |
32327 | 32380 | 48300 | Y | 3000 | Arizona |
32380 | 32380 | 53400 | Y | 3000 | Arizona |
32382 | 32380 | 55600 | Y | 3000 | Arizona |
Answer)
Q1. SQL statement to update the salary for John Jones:
UPDATE empsal
SET salary=60000
WHERE id in (
select id from empinfo
where first='John' and last='Jones'
);
Q2. SQL statement to update all salaries by 5%:
UPDATE empsal
SET salary=salary*1.05;
Q3. SQL statement to update all salaries by 5% for only the employees who live in Arizona:
UPDATE empsal
SET salary=salary*1.05
where id in (
select id from empinfo
where state='Arizona'
);
Q4. SQL statement to insert a new record into the empinfo table:
insert into empinfo values('Mark','Rogers',99999,35,Payson,Arizona);
Q5. SQL statement to add a new record into the empinfo table, employee's first and last names along with their age:
INSERT INTO empinfo (first,last,age)
VALUES ('William','Skins',35);
**Please Hit Like if you appreciate my answer. For further doubts on the question or answer please drop a comment, I'll be happy to help. Thanks for posting.**
1. Display the query you would write to update the salary for John Jones 2. Display...
Please help me on the SQL
queries, thank you so much.
Write a query to display the
title and publisher as well as the publisher contact for each book
using JOIN...USING clause.
Write a query to show the
first and last names of customers who have ordered cooking books.
Use the WHERE clause to join the tables.
Write a query to show the
title, cost and ISBN of each book in the books table. If the book
has been ordered,...
SQL/Oracle EMPLOYEE Table ID NAME GENDER SALARY COUNTRY 1 Mark Male 5000 USA 2 John Male 4500 Canada 3 Pam Female 5500 USA 4 Sara Female 4000 Canada 5 Todd Male 3500 Canada 6 Mary Female 5000 UK 7 Ben Male 6500 UK 8 Elizabeth Female 7000 USA 9 Tom Male 5500 UK 10 Ron Male 5000 USA Given the EMPLOYEE table above, write a query that would produce the output below. COUNTRY GENDER Total Salary ---------- ---------- ------------ Canada Female 4000 Canada Male 8000 UK Female 5000...
SQL/Oracle EMPLOYEE Table ID NAME GENDER SALARY COUNTRY 1 Mark Male 5000 USA 2 John Male 4500 Canada 3 Pam Female 5500 USA 4 Sara Female 4000 Canada 5 Todd Male 3500 Canada 6 Mary Female 5000 UK 7 Ben Male 6500 UK 8 Elizabeth Female 7000 USA 9 Tom Male 5500 UK 10 Ron Male 5000 USA Given the EMPLOYEE table above, write a query that would produce the output below. COUNTRY GENDER Total Salary ---------- ---------- ------------ Canada Female 4000 Canada Male 8000 Canada NULL 12000...
1. Write an Sql statement to display all the columns in the driver table Write an SQL statement to display the name, location, and certified for all drivers that have Certified equal to Y. Sort the results in descending order by driverid 3. Write an SQL statement to display the group the data by driverid so we can find the sum of hours and miles logged from timesheet 4. Write an update statement to set the certified to P for...
Write the following SQL statements in Microsoft Access by using the Books database from Week 2 Assignment 2. Once complete, copy and paste the SQL statements in a Microsoft Word document: Write SQL statements: To update the publisher name from READ WITH US to READ FOR US To verify the updated name field for the publisher with ID 6 To make the following updates to the Publisher table (be careful with WHERE): Make Contact="John Travolta" for publisher with ID number...
Assignment Chapter 6 Part - Assignment Chapter 6 Part 2 - Write Queries that: 1. List all Staff first and last names that have a branch number listed the Branch table. 2. Sort the query results from the query above is descending order 3. Join Branch and Staff tables where branch No are equal 4. Execute Left Outer Join for query 3 5. Execute Right Outer Join for query 3. 6. Insert record - 'CR76', 'PL94', '2018-02-28', 'To Big' into...
Overview This lab provides you the opportunity to insert and update data with the use of SQL commands. The lab will utilize the FLIX2YOU problem, the current schema. In order to start this lab, you must have successfully completed Lab # 6. In Lab # 6, you executed a script that was provided to you. This script created 7 of the FLIX2YOU tables as documented in the Entity Relationship Diagram in the FLIX2YOU problem document. The second part of lab...