13:49:06 create table t_studentInfo( id int primary key auto_increment, name varchar(45) unique, age int default 18, sex enum('男','女') not null ) Error Code: 1046. No database selected Select the default DB to be used by double-clicking its name in the SCHEMAS list in the sidebar. 0.000 sec
时间: 2024-03-24 07:41:34 浏览: 111
这是一段SQL语句,但是在执行时出现了错误,错误代码为1046,意味着没有选中数据库。你需要在执行该语句之前先选择要使用的数据库,可以在MySQL命令行工具中使用以下命令选择要使用的数据库:
```
use database_name;
```
其中,database_name是你要使用的数据库名称。执行完该命令后,再执行上述SQL语句即可创建名为t_studentInfo的表。
相关问题
向表中一次插入多行数据的SQL语句为:_________ INTO studentinfo(user_name, user_sex, user_age, user_birthday) _________ ('付浩',1,22, '1999-10-26'),('艾晓丽',0,22, '1999-12-14'),('代盈盈',0,20, '2001-7-8');
INSERT, VALUES.
完整的SQL语句应该是:
```
INSERT INTO studentinfo(user_name, user_sex, user_age, user_birthday)
VALUES ('付浩',1,22, '1999-10-26'),('艾晓丽',0,22, '1999-12-14'),('代盈盈',0,20, '2001-7-8');
```
class Student(Person): def __init__(self, college, name, age, sex): super().__init__(name, age, sex) self.college=college self.class=class def personInfo(self): super().personInfo() print("学院:",self.college,
class Student(Person):
def __init__(self, college, name, age, sex, class_name):
super().__init__(name, age, sex)
self.college = college
self.class_name = class_name
def studentInfo(self):
print("姓名:", self.name, "年龄:", self.age, "性别:", self.sex, "学院:", self.college, "班级:", self.class_name)
def personInfo(self):
super().personInfo()
print("学院:", self.college, "班级:", self.class_name)
# 示例调用
s1 = Student("清华大学", "张三", 20, "男", "计算机科学与技术1班")
s1.personInfo()
s1.studentInfo()
阅读全文