-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path03_import_data.sql
More file actions
70 lines (66 loc) · 2.11 KB
/
Copy path03_import_data.sql
File metadata and controls
70 lines (66 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
USE business_performance;
SELECT DATABASE();
SHOW TABLES;
LOAD DATA LOCAL INFILE 'C:/Users/Tripti Sahu/Desktop/P/Business-Performance-SQL/Dataset/stores.csv'
INTO TABLE business_performance.stores
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 ROWS;
SELECT COUNT(*) AS total_stores
FROM business_performance.stores;
USE business_performance;
LOAD DATA LOCAL INFILE 'C:/Users/Tripti Sahu/Desktop/P/Business-Performance-SQL/Dataset/employees.csv'
INTO TABLE business_performance.employees
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 ROWS;
SELECT COUNT(*) AS total_employees
FROM business_performance.employees;
SELECT *
FROM business_performance.employees
LIMIT 5;
USE business_performance;
LOAD DATA LOCAL INFILE 'C:/Users/Tripti Sahu/Desktop/P/Business-Performance-SQL/Dataset/products.csv'
INTO TABLE business_performance.products
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 ROWS;
SELECT COUNT(*) AS total_products
FROM business_performance.products;
USE business_performance;
LOAD DATA LOCAL INFILE 'C:/Users/Tripti Sahu/Desktop/P/Business-Performance-SQL/Dataset/customers.csv'
INTO TABLE business_performance.customers
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 ROWS;
SELECT COUNT(*) AS total_customers
FROM business_performance.customers;
USE business_performance;
LOAD DATA LOCAL INFILE 'C:/Users/Tripti Sahu/Desktop/P/Business-Performance-SQL/Dataset/targets.csv'
INTO TABLE business_performance.targets
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 ROWS;
SELECT COUNT(*) AS total_targets
FROM business_performance.targets;
USE business_performance;
LOAD DATA LOCAL INFILE 'C:/Users/Tripti Sahu/Desktop/P/Business-Performance-SQL/Dataset/sales.csv'
INTO TABLE business_performance.sales
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 ROWS;
SELECT COUNT(*) AS total_sales
FROM business_performance.sales;
SELECT *
FROM business_performance.sales
LIMIT 10;
SELECT
MIN(sale_date) AS first_sale,
MAX(sale_date) AS last_sale
FROM business_performance.sales;