0% found this document useful (0 votes)
52 views1 page

(ID Number (3), Name VARCHAR (50), AGE Number (3), Salary Number (9) )

This document contains questions about SQL queries. It includes queries to: 1) Create a Salesperson table with ID, Name, Age, and Salary columns. 2) Insert values into an orders table and update an industry type field. 3) Select orders matching a customer name and salesperson names with more than one order. 4) Select orders from a certain year. 5) Select customers starting with S and ending in Y, and the highest salary. 6) Create a sequence for salesperson IDs and a table with the ID as primary key. 7) Sum the amounts for each customer ID and group by the customer ID.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views1 page

(ID Number (3), Name VARCHAR (50), AGE Number (3), Salary Number (9) )

This document contains questions about SQL queries. It includes queries to: 1) Create a Salesperson table with ID, Name, Age, and Salary columns. 2) Insert values into an orders table and update an industry type field. 3) Select orders matching a customer name and salesperson names with more than one order. 4) Select orders from a certain year. 5) Select customers starting with S and ending in Y, and the highest salary. 6) Create a sequence for salesperson IDs and a table with the ID as primary key. 7) Sum the amounts for each customer ID and group by the customer ID.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Question # 1.

a)
CREATE TABLE Salesperson
(ID number(3), Name VARCHAR(50), AGE number(3),Salary number(9));

Question # 2.
a)
Insert INTO order
Values (10,'8/2/96', 4, 2, 540);
b)
Insert update
set [industry Type] =A
Where [industry Type] =J
Question # 3.
a)
SELECT * FROM orders
WHERE cust_ID=(

SELECT Name FROM customer WHERE Name='samsonic');

b)
SELECT Name
FROM Orders,Salesperson
Where orders.salesperson_id=salesperson.id
GROUP BY Name,Salesperson_ID
HAVING Count (Salesperson_ID )>1
Question # 4.
c)
SELECT * FROM order WHERE RIGHT (order_date,2)=95
Question # 5.
a)
SELECT * FROM Customers WHERE Name LIKE 'S%Y';

b)
SELECT Max(Salary) as Highest_salary FROM Salesperson;

c)
SELECT * FROM orders WHERE salesperson_ID
NOT IN (SELECT salesperson_ID FROM orders);

Question # 6.
a)
CREATE SEQUENCE Salesperson_ID
START WITH
1000
INCREMENT BY
1
NOCACHE
NOCYCLE;

b)
CREATE TABLE Salesperson
(
Salesperson_Id int NOT NULL,
Name varchar(255) NOT NULL,
Age number(3),
Salary number(9) CHECK (Salary =>20000),);
Question # 7.
b)
Select Customer_id, Sum(Amount) from order
Group by Customer_id;

You might also like