提交 e246f5e4 创建 作者: 王晓庆's avatar 王晓庆

6

上级 661e6ddf
流水线 #117310 已通过 于阶段
用时 22 秒
...@@ -17,7 +17,7 @@ cursor.execute("CREATE DATABASE wxq2") ...@@ -17,7 +17,7 @@ cursor.execute("CREATE DATABASE wxq2")
conn.autocommit(False) conn.autocommit(False)
# 读取 sql 文件文本内容 # 读取 sql 文件文本内容
sql = open('test2.sql', 'r', encoding = 'utf8') sql = open('testdb.sql', 'r', encoding = 'utf8')
sqltxt = sql.readlines() sqltxt = sql.readlines()
# 此时 sqltxt 为 list 类型 # 此时 sqltxt 为 list 类型
......
CREATE DATABASE wxq; USE wxq2;
USE wxq;
IF OBJECT_ID('persons', 'U') IS NOT NULL IF OBJECT_ID('persons', 'U') IS NOT NULL
DROP TABLE persons DROP TABLE persons
...@@ -12,7 +10,7 @@ CREATE TABLE persons ( ...@@ -12,7 +10,7 @@ CREATE TABLE persons (
) )
INSERT INTO persons VALUES ('1', 'John Smith', 'John Doe') INSERT INTO persons VALUES ('1', 'John Smith', 'John Doe')
INSERT INTO persons VALUES ('2', 'Jane Doe', 'Joe Dog') INSERT INTO persons VALUES ('2', 'Jane1122 Doe3344', 'Joe Dog')
INSERT INTO persons VALUES ('3', 'Mike T.', 'Sarah H.') INSERT INTO persons VALUES ('3', 'Mike T.', 'Sarah H.')
SELECT * FROM persons WHERE salesrep='Joe Dog' SELECT * FROM persons WHERE salesrep='Joe Dog'
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论