SQL Exercises, Practice, Solution - Retrieve Data From Tables
SQL Exercises, Practice, Solution - Retrieve Data From Tables
Write a SQL statement that displays all the information about all salespeople
select * from salesman;
2. Write a SQL statement to display a string "This is SQL Exercise, Practice and
Solution".
SELECT 'This is SQL Exercise, Practice and Solution' AS result FROM dual;
3. Write a SQL query to display three numbers in three columns.
select 1 col1,2 col2,3 col3 from dual;
4. Write a SQL query to display the sum of two numbers 10 and 15 from the RDBMS
server.
select 10+15 sum from dual;
5. Write an SQL query to display the result of an arithmetic expression.
select 2+25-3*4/2 "arithmetic expression" from dual;
6. Write a SQL statement to display specific columns such as names and commissions
for all salespeople.
select name,commission from salesman;
7. Write a query to display the columns in a specific order, such as order date,
salesman ID, order number, and purchase amount for all orders.
select ord_date,salesman_id,ord_no,purch_amt from orders;