1.
CREATE TABLE users_new LIKE users;
2.
INSERT INTO users_new SELECT * FROM users;
3.
ALTER TABLE users ADD salary INT;
UPDATE users, occupation
SET salary =
(
case
when occupation.name = 'Software Engineer' then 80000
when occupation.name = 'Accountant' then 75000
when occupation.name = 'Pharmacist' then 90000
end
)
WHERE users.occ_id= occupation.id;
1. Answer the questions with respect to the table below. users gender id name age occ_id...
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...
Assume the table below is a client table: Client ID Client Name Client Services Client City Client Revenue Client type (active/inactive) 1 BK Associates Commercial Toronto 230,000 active 6 Bick Industrial Dallas 679,000 inactive 19 TPH Government Atlanta 986,000 active 12 Crow Industrial Phoenix 126,000 inactive 56 TX Electric Industrial Portland 564,000 active 42 GRB Government Omaha 437,000 inactive 98 LB&B Commercial Toronto 990,000 active 44 H&P Commercial Denver 122,000 active You are asked to implement a C# console application...
Please answer the following questions
bles Charts SmartArtReview Paragraph AaBbCcDdEe Normal Name: ID Name: ID: Question (1) For the following periodic signal, (5p 2) Write os os5 2WY 1) Determine the Fourier series coefficient as an b Sec 1 Pages 1 of 4 Words: 63 of 83 L 25
1. Given the table above, write an SQL Query that will select
only those individuals that scored 800 or higher, sorted by last
name in ascending order.
2. Given the table above, write an SQL Query that will add a new
entry for John Smith with a score of 834. The field id is auto
incrementing.
3. Given the data below, write an SQL Query that will delete any
values where the score is below 740.
id Fname Lname Score...
Part II: Group-by and subqueries The following questions use the Spy and Sailors database. Write the SQL for the following queries. 1) List the sailor id and name for each sailor who has reserved two different red boats. Make sure that each sailor id/name is listed at most once. You must use group by/having. 2) List the missions and their status for each team. 3) For each country in agent, list the country and the count of agents in the...
1.Write a PHP function that generates a random email. 2.Write a PHP function that generates a random password given the length as a parameter. 3. Run a query that will generate a database named lab4 b. 4.Run a query that will create a table named users, the table will only have three columns, email TEXT and password TEXT, ID INTEGER NOT NULL AUTO_INCREMENT. ID will be the primary key that will be generated for us automatically based on the record...
SQL Homework 1. For each reservation, list the reservation ID, trip ID, customer number, and customer last name. Order the results by customer last name. 2. For each reservation for customer Ryan Goff, list the reservation ID, trip ID, and number of persons. 3. List the trip name of each trip that has Miles Abrams as a guide. 4. List the trip name of each trip that has the type Biking and that has Rita Boyers as a guide. 5....
QUESTION: (Answer in SQL) Write an SQL query to find all pairs of users (A,B) such that both A and B have blurted on a common topic but A is not following B. Your query should print the names of A and B in that order. BACKGROUND INFO: Users can post their thoughts in form of short messages that we call “blurts”. When signing up, users need to provide their email and a password of their choice. In addition, they...
HELP DATABASE QU
Question 1: Think About the relational database table data as given below, write the following queries in Oracle SQL. Company (Cid, Cname, City, Budget, Branch) Department (Deptno, Dname, Building, Cname) Employee (Ename, Deptno, Street, City, Phone, Salary) Works (Ename, Deptno, Hire_date) Location (Cname, Location ) 1. Write Query to Create the Company table, suggest appropriate data type of each attribute, consider that there should be a name for each company. 2. Find employee name/names who live in...