DAY1——sql 建表/插入数据

#创建db1数据库,创建一张运动员表(id, name, gender, height, position).
#其中position为下面五种之一: 'Point Guard', 'Shooting Guard', 'Small Forward', 'Power Forward', 'Center'。
#并往里面插入5条数据。
drop database if exists db1;
create database if not exists db1;
create database if not exists mydb2 character set gbk;
show databases;

use db1;
create table t_athletes(
id int primary key,
    `name` varchar(255) not null,
    gender enum('male','female'),
    height int,
    posion enum('Point Guard', 'Shooting Guard', 'Small Forward', 'Power Forward', 'Center')
);

insert into t_athletes values (1,'沈腾','male',180,'Point Guard');
insert into t_athletes values (2,'贾玲','female',166,'Shooting Guard');
insert into t_athletes values (3,'马丽','female',168,'Point Guard');
insert into t_athletes values (4,'艾伦','male',187,'Small Forward');
insert into t_athletes values (5,'常远','male',182,'Center');

select * from t_athletes;
发布了2 篇原创文章 · 获赞 0 · 访问量 70

猜你喜欢

转载自blog.csdn.net/qq_39621508/article/details/104594732
今日推荐