Mysql基本语法学习篇(1)

1.创建一个test数据库 

create database test;

2.使用数据库

use test;

3.创建三个数据表

create table if not exists t_account (
  id  int(11) primary key not null ,
  account_name  varchar(20)  not null comment '管理员名称',
  account_passwd varchar(50) not null  comment '管理员密码',
  tel varchar(50) not null comment '管理员电话号码'  ,
  true_name  varchar(50)  not null comment '管理员姓名'
)charset=utf8;
create table if not exists student(
 id int(11) primary key not null,
 sno  int(11) not null comment '学生学号', 
 stu_name varchar(50) not null  comment '学生姓名',
 stu_sex char(10) not null  comment '学生性别',
 stu_birthday date  not null comment '学生出生日期',
 stu_address varchar(100) not null comment '学生地址'
)charset=utf8;
create table if not exists score(
  id int(11) primary key not null,
  course_name varchar(50) not null comment '课程名称',
  stu_score int(11) not null comment '学生成绩'
)charset=utf8;

4.执行三个数据表id自动递增

alter table t_account change column id id int(11) not null auto_increment first;
alter table student change column id id int(11) not null auto_increment first;
alter table score change column id id int(11) not null auto_increment first;

 

 5.查看表结构

desc t_account;

6.插入数据值

insert into t_account (account_name,account_passwd,tel,true_name) values
('admin','123456','13666888333', '李经理'),
('test','123456','13666333444','测试员');

 

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

路来了

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值