diff --git a/2208/天天乐学考试答案/MySQL练习(一).md b/2208/天天乐学考试答案/MySQL练习(一).md index 9b6aa6b..4caee37 100644 --- a/2208/天天乐学考试答案/MySQL练习(一).md +++ b/2208/天天乐学考试答案/MySQL练习(一).md @@ -194,3 +194,34 @@ SELECT @result; ### 第三套 +```sql +#1 +CREATE TABLE tb_order( + oid INT PRIMARY KEY AUTO_INCREMENT COMMENT '订单ID', + odate DATETIME NOT NULL COMMENT '下单日期', + quantity INT NOT NULL DEFAULT 1 COMMENT '下单数量' +); + +#2 +ALTER TABLE tb_books MODIFY price DECIMAL(10, 2); + +#3 +ALTER TABLE tb_book_authors ADD CONSTRAINT tB_ibfk_1 FOREIGN KEY(book_id) REFERENCES tb_books(book_id); + +ALTER TABLE tb_book_authors ADD CONSTRAINT tB_ibfk_2 FOREIGN KEY(author_id) REFERENCES tb_authors(author_id); + +#4 +ALTER TABLE tb_authors ADD avatar MEDIUMBLOB; + +#5 +#使用查询和LOAD_FILE函数 导入指定路径的图片 +SELECT LOAD_FILE('C:/TTLXExam/20501071168/MYSQLDB/3/jinyong.jpg'); + +UPDATE tb_authors a +SET a.avatar = LOAD_FILE('C:/TTLXExam/20501071168/MYSQLDB/3/jinyong.jpg') +WHERE a.author_name = '金庸'; + +#6 + +``` +