DDL+DML
CREATE TABLE student (id INT AUTO_INCREMENT PRIMARY KEY,createDate DATETIME NOT NULL,userName VARCHAR(255) NOT NULL,phone VARCHAR(20) NOT NULL,age INT NOT NULL,sex ENUM('男', '女', '其他') NOT NULL,introduce TEXT
);
INSERT INTO student (createDate, userName, phone, age, sex, introduce) VALUES
('2023-10-23 10:00:00', '张先生', '13800138000', 30, '男', '张先生是计算机科学专业的学生,对编程有浓厚兴趣。'),
('2023-10-23 11:00:00', '李小姐', '13900139000', 25, '女', '李小姐热爱艺术,喜欢绘画和音乐。'),
('2023-10-23 12:00:00', '王同学', '13700137000', 22, '男', '王同学是体育健将,擅长篮球和足球。'),
('2023-10-23 13:00:00', '赵女士', '13600136000', 28, '女', '赵女士是一名医生,致力于医学研究。'),
('2023-10-23 14:00:00', '陈先生', '13500135000', 35, '男', '陈先生是企业家,经营一家科技公司。');
百度AI
DELIMITER //CREATE PROCEDURE get_userName_introduce()
BEGIN-- 声明变量用于存储查询结果DECLARE user_introduce TEXT;-- 查询userName为'张先生'的学生的introduce信息SELECT introduce INTO user_introduceFROM studentWHERE userName = '张先生';-- 输出查询结果SELECT user_introduce;
END //DELIMITER ;
CALL get_userName_introduce();