Ey SQL Wriiten Test
Ey SQL Wriiten Test
Q3)
Salesperson Customer
b. The names of all salespeople that do not have any order with Samsonic.
d. Write a SQL statement to insert rows into a table called highAchiever(Name, Age),
where a salesperson must have a salary of 100,000 or greater to be included in the
table.
Q4)
User
user_id
name
phone_num
UserHistory
user_id
date
action
1. Write a SQL query that returns the name, phone number and most recent date for any
user that has logged in over the last 30 days (you can tell a user has logged in if the
action field in UserHistory is set to "logged_on").
Every time a user logs in a new row is inserted into the UserHistory table with user_id,
current date and action (where action = "logged_on").
2. Write a SQL query to determine which user_ids in the User table are not contained in
the UserHistory table (assume the UserHistory table has a subset of the user_ids in User
table). Do not use the SQL MINUS statement. Note: the UserHistory table can have
multiple entries for each user_id.
Q5) WRITE A STORED PROCEDURE TO INVERT THE STRING ‘ERNST AND YOUNG’ AS ‘GNUOY DNA
TSNRE’
Q6)WRITE A QUERY TO DISPLAY THE 2ND HIGHEST SAL OF EMPLOYEE IN EMPLOYEE TABLE.