Assignment
1. CREATE DATABASE salesinformation;
CREATE TABLE sales_data (sale_date date, client_name varchar, product_name varchar, total_dsum int);
SELECT total_dsum FROM sales_data WHERE total_dsum > 0; SELECT * FROM sales_data ORDER BY sale_date ASC;
SELECT * FROM sales_data ORDER BY total_dsum DESC;
2. CREATE TABLE sales_data (sale_date date, client_name varchar, product_name varchar, total_dsum int);
SELECT * FROM sales_data ORDER BY sale_date ASC; SELECT * FROM sales_data ORDER BY total_dsum DESC;
3. CREATE TABLE sales_info (sale_year int, sale_month varchar, client_name varchar, product_name varchar, total_msum int);
SELECT sale_year, sale_month FROM sales_info GROUP BY sale_year, sale_month; SELECT total_msum FROM sales_info WHERE total_msum < 15000;
4. CREATE TABLE client_info (client_name varchar, total_ysum int); SELECT total_ysum FROM client_info WHERE total_ysum IS NOT NULL;
5. CREATE TABLE client_info (client_name varchar, total_ysum int); SELECT client_name FROM client_info WHERE client_name like ‘R%';
6. CREATE TABLE client_info (client_name varchar, total_ysum int); SELECT * FROM client_info ORDER BY total_ysum DESC;
SELECT TOP 3 * FROM total_ysum;
7. CREATE TABLE product_info (client_name varchar, product_name1 varchar, product_name2 varchar, product_name3 varchar, total_sum int);
SELECT * FROM product_info ORDER BY client_name ASC; SELECT * FROM product_info ORDER BY total_sum DESC;
SELECT total_sum FROM product_info WHERE total_sum > 0;