-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsql.txt
94 lines (78 loc) · 2.81 KB
/
sql.txt
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
sql2 = "INSERT ignore INTO member_table (originallink," \
"link," \
"title," \
"description," \
"pubDate) VALUES (%s,%s,%s,%s,%s);"
sql3 = "DELETE FROM member_table;"
sql = "SELECT * FROM member_table"
sql = "CREATE TABLE member_table (" \
"originallink VARCHAR(255)," \
"link VARCHAR(255)," \
"title VARCHAR(255)," \
"description VARCHAR(255)," \
"pubDate VARCHAR(255), " \
"PRIMARY KEY(originallink))"
sql2 = "alter table member_table add total int"
sql3 = "CREATE TABLE member_table2 (" \
"lastBuildDate string," \
"total int)"
CREATE TABLE member
(
member_id BIGINT NOT NULL AUTO_INCREMENT,
nickname VARCHAR(39) NOT NULL,
login_id VARCHAR(15) NOT NULL,
login_password VARCHAR(20) NOT NULL,
create_at DATETIME,
last_modified_at DATETIME,
last_login_ip_address VARCHAR(45),
deleted VARCHAR(5)
);
CREATE TABLE news_bookmark
(
bookmark_id BIGINT NOT NULL AUTO_INCREMENT,
news_id BIGINT NOT NULL,
member_id BIGINT NOT NULL,
create_at DATETIME,
FOREIGN KEY (member_id)
REFERENCES member (member_id)
);
CREATE TABLE news
(
news_id BIGINT NOT NULL AUTO_INCREMENT,
news_title VARCHAR(255) NOT NULL,
news_description VARCHAR(255) NOT NULL,
company_id BIGINT ,
original_link VARCHAR(1500),
naver_link VARCHAR(1500),
published_at DATETIME,
create_at DATETIME,
last_modified_at DATETIME,
deleted VARCHAR(5)
);
Fri, 17 Mar 2023 10:50:00 +0900
%w %d %m %y %t
CREATE TABLE company
(
company_id BIGINT NOT NULL AUTO_INCREMENT,
company_name VARCHAR(58),
news_count int,
company_image_url VARCHAR(1500)
);
sql = "INSERT INTO news (news_title," \
"original_link," \
"naver_link," \
"news_description," \
"published_at, create_at, last_modified_at, deleted) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);"
sql2 = "INSERT INTO member_table2 (lastBuildDate,total) VALUES (%w, %d, %m, %y, %t, %s);"
# Fri, 17 Mar 2023 10: 50:00 + 0900
# % a % d % m % y % t
sql3= "INSERT INTO [Table 명] ('Col 1', 'Col 2')" \
"SELECT '값 1', '값 2' FROM DUAL" \
"WHERE NOT EXISTS" \
"(SELECT 'Col 1', 'Col 2' FROM [Table 명]" \
" WHERE 'Col 1' = '값 1' AND 'Col 2' = '값 2')"
sql5 = "SELECT * " \
" FROM news" \
"WHERE EXISTS (SELECT original_link FROM news WHERE original_link = %s);"
sql6 = "SELECT n.original_link FROM news AS n" \
"WHERE n.original_link = %s"