Consider following schema and write SQL for given statements.title (id,designation,DOJ)bonus(id,bonus_date,amount)1. List out bonus id whose designation is MANAGER .2. List out id's whose bonus amount at most 4000 and designation is admin
Question
Consider following schema and write SQL for given statements.title (id,designation,DOJ)bonus(id,bonus_date,amount)1. List out bonus id whose designation is MANAGER .2. List out id's whose bonus amount at most 4000 and designation is admin
Solution
- To list out bonus id whose designation is MANAGER, you would use a JOIN to combine the two tables on the 'id' field, and then use a WHERE clause to filter for rows where the designation is 'MANAGER'. Here is the SQL for this:
SELECT bonus.id
FROM title
JOIN bonus ON title.id = bonus.id
WHERE title.designation = 'MANAGER';
- To list out id's whose bonus amount is at most 4000 and designation is 'admin', you would again use a JOIN to combine the two tables on the 'id' field, and then use a WHERE clause to filter for rows where the bonus amount is at most 4000 and the designation is 'admin'. Here is the SQL for this:
SELECT bonus.id
FROM title
JOIN bonus ON title.id = bonus.id
WHERE bonus.amount <= 4000 AND title.designation = 'admin';
Similar Questions
Consider following schema and write SQL for given statements.title (id,designation,DOJ), bonus(id,bonus_date,amount)Create tables with Primary Key, foreign key constraints in given schemas.1)Retrieve the employees who haven't received any bonuses.2)Retrieve the total bonus amount received by each employee.3)Retrieve the highest bonus amount received.4)List out id's whose bonus amount is at most 4000 and designation is admin
Consider following schema and write SQL for given statements.worker (id,firstname,lastname,salary,joining_date,dept)bonus(id,bonus_date,amount)1. Find firstname and lastname of worker whose amount is greater than 2400.2. List out salary of worker with id who got bonus
Consider following schema and write query for given statementEmp (eid,ename,city,dname,salary) Project(eid,pid,pname,location)Create tables with Primary Key, foreign key constraints in given schemas.(1) Display name of employees who belongs to Computer department.(2) Display employee id whose name starts from letter J.(3) Display all details of employees whose salary is from 10000 to 20000.(4) Display name of employees who are having maximum salary.(5) Display name of employees whose salary is higher than average salary of the employee.(6) Display name of employees whose project id is 3 and location is Mumbai
Consider following schema and write SQL for given statements.Student (RollNo, Name, DeptCode, City)Department (DeptCode, DeptName)Result (RollNo, Semester, SPI)1. List out the RollNo, Name along with SPI of Student.2. Display student name who got highest SPI in semester 1.3. Display the list of students whose DeptCode is 5, 6,7,10
Write SQL QueriesEmployee TableDepartment Table1. Get the list of employees whose salary is more than 20K and are in HR department.2. Get the salary being paid to each Department.3. Get the employees with the third highest salary.4. Name and designation of the employees who don't have any manager
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.