Write the following SQL queries based on hbsoe database from Mode:
Select all the employee information and list them for first 100 only.
Select all the order information from country Germany.
How many distinct orders are made from each country?
List the names of employees who made orders from country Germany.
List the names of companies which supplies chai or tofu
Answer:
you did not specified the question well here , how many tables are there and what are the attributes , so as per my understanding i am assuming employee, company and orders are different tables here .
Before starting the execution of SQL queries on table first we go inside the database given hbsoe.
Command:
USE hbsoe;
a) Select all the employee information and list them for first 100 only.
SELECT TOP 100 * FROM employee ;
b)Select all the order information from country Germany.
SELECT *FROM order where country="Germany" ;
c)How many distinct orders are made from each country?
SELECT count( orderid ) as No_of_Id, country FROM Orders group by country;
d)List the names of employees who made orders from country Germany?
SELECT employee_name FROM emplyee INNER JOIN orders ON employee.employeeID=orders.employeeID where country="Germany" ;
e)List the names of companies which supplies chai or tofu
SELECT company_name from company where supplies='chai' or supplies='tofu';
Please give me more details about the tables if some of the answer will not right because you din't provided the details of tables and there attributes.
let me know if any doubt.
Get Answers For Free
Most questions answered within 1 hours.