暂无图片
暂无图片
暂无图片
暂无图片
暂无图片
【mysql数据库基础】.pdf
91
7页
0次
2023-06-05
5墨值下载
mysql
·
· ---
· ---
·RDBMS
·SQL
·MYSQL SQL MYSQL
·SQL
· SQL sqlite3 oracle
.SQL
·DQL
·DML
·MYSQL
· C C++
·
·线线 CPU
linux-ubantu
( )
1. mysql -uroot -p
mysql -uroot -pmysql
2.退退 exit/quit/ctrl+d
3. show databases
4.select now()
5. select version():
6. create database+
create database+ +charset=utf8 # utf8 latin
7. show creat databases+
8. drop database+
9.使使 select database():
10.使使 use+
( )
1.show tables
2. create table (id int,name varchar(30))
1 create table xxxxx(id int,name varchar(30));
2 create table yyyyy(id int primary key not null auto_increment,name varchar(30));
2 primary key not null auto_increment .
·
create table students(
id int unsigned not null auto_increment primary key, # aotu_increment
name varchar(30),
age tinyint unsigned default 0, # default
high decimal(5,2), # decimal(5,2) 5 2
gender enum(' ',' ',' ') default ' ' # enum()
cls_id int unsigned
):
3. desc+
4. insert into students values(1,' ',18,188.88,' ',0) #
( )
1. alter table add
2. alter table modify
·alter table students modify birthday date
3. alter table change
·alter table students change birthday birth
4. alter table drop
·alter table students drop birthday #
5. drop database
drop table
( )
1.show create tables +
·show create tables students
· ---> students | CREATE TABLE `students` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(30) DEFAULT NULL,
`age` tinyint(3) unsigned DEFAULT NULL,
`high` decimal(5,2) DEFAULT NULL,
`gender` enum('male','female','others') DEFAULT 'male',
`cls_id` int(10) unsigned DEFAULT NULL,
`birthday` date DEFAULT '2000-01-01',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8
curd create updata retrieve delete
insert into values
1.
# 使使 0 null default
insert into students values(0,' ',20,168.05,'male',2,'1990-01-01');
insert into students values(null,' ',20,168.05,'male',2,'1990-01-01');
insert into students values(default,' ',20,168.05,'male',2,'1990-01-01');
# enum : 1 male 2 female 3 others
insert into students values(0,' ',20,168.05,1,0,'1990-01-01');
insert into students values(0,' ',20,168.05,2,0,'1990-01-01');
insert into students values(0,' ',20,168.05,3,0,'1990-01-01');
+----+----------+------+--------+--------+--------+------------+
| id | name | age | high | gender | cls_id | birthday |
+----+----------+------+--------+--------+--------+------------+
| 1 | | 18 | 188.88 | male | 0 | NULL |
| 2 | | 20 | 177.77 | male | 1 | NULL |
| 3 | | 20 | 168.05 | male | 2 | 1990-01-01 |
| 4 | | 20 | 168.05 | male | 2 | 1990-01-01 |
| 5 | | 20 | 168.05 | male | 2 | 1990-01-01 |
| 6 | | 20 | 168.05 | male | 0 | 1990-01-01 |
| 7 | | 20 | 168.05 | female | 0 | 1990-01-01 |
| 8 | | 20 | 168.05 | others | 0 | 1990-01-01 |
+----+----------+------+--------+--------+--------+------------+
2.
1.
insert into students (name,gender) values(' ',2);
| 8 | | 20 | 168.05 | others | 0 | 1990-01-01 |
| 9 | | NULL | NULL | female | NULL | 2000-01-01 |
+----+----------+------+--------+--------+--------+------------+
2.
insert into students (name,gender) values(' ',2),(' ',2);
| 10 | | NULL | NULL | female | NULL | 2000-01-01 |
| 11 | | NULL | NULL | female | NULL | 2000-01-01 |
+----+----------+------+--------+--------+--------+------------+
3.
insert into students values(0,'西 西 ',21,165.00,2,0,'2000-02-02'),(0,' ',22,167.00,2,0,'2000-02-02');
of 7
5墨值下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

关注
最新上传
暂无内容,敬请期待...
下载排行榜
Top250 周榜 月榜