您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

对MySQL的初步了解

2025/12/20 16:26:26发布14次查看
首先安装mysql:
一.单词部分:
①networking网络②option选择③port端口④firewall防火墙⑤engine引擎
⑥standard标准⑦character字符⑧collation校对⑨stirage存储
create 创建     drop 删除   comment 评论  variables变量
二.预习部分
1.请写出创建和删除数据库的sql语句
create database 数据库名;
drop database 数据库名;
2.写出创建和删除表的sql语句
create table 表名(
字段  数据类型  约束,
...,
...
)
drop table 名字;
3.查看表
show tables;
4.指定表的存储引擎
create table 表名(
.........
)enegine=存储引擎;
三.练习部分
1.完成对mysql数据库的配置(问度娘。。。)
2.使用命令行连接mysql并操作数据库
mysql -h服务器地址 -u用户名 -p 密码
3.使用sql语句创建科目表
#上机三课程表
drop database if exists `myschool`;
create database myschool;
use myschool;
drop table if exists `subject`;
create table `subject`(
`subjectno`  int(4) not null comment '课程编号' auto_increment primary key,
`subjectname`  varchar(50) comment '课程名称',
`classhour`  int(4) comment '学时',
`gradeid`  int(4) comment '年级编号'
);
4.上机4使用sql语句创建成绩表
#上机四timestamp 成绩表
drop table if exists `result`;
create table `result`(
`studentno` int(4) not null,
`subjectno` int(4) not null,
`examedate` timestamp  not null default now() ,
`studentresult` int(4) not null
);
5.创建学生表和年级表
#上机五学生表和年级表
drop table if exists `student`;
create table `student`(
`studentno` int(4) not null primary key,
`loginpwd` varchar(20) not null,
`studentname` varchar(50)  not null,
`sex` char(2) not null,
`gradeid` int(4) unsigned,
`phone` varchar(50),
`address` varchar(255),
`borndate` datetime,
`eamil` varchar(50),
`identitycard` varchar(18)
);
drop table if exists `grade`;
create table `grade`(
`gradeid` int(4) not null auto_increment primary key,
`gradename` varchar(50) not null
);
6.使用系统帮助
help 查询内容;
四.总结部分
mysql的存储引擎
常用的存储引擎:innodb,myisam
innodb:支持事务处理,外键。占用空间比myisam大,适合需要事务处理,更新,删除频繁的场景
myisam:不支持事务和外键,占用空间较小,访问速度快,适合于不需要事务处理,频繁查询的应用场景
以上就是对mysql的初步了解的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product