当前位置: 首页 > news >正文

网站域名价值查询品牌推广软文200字

网站域名价值查询,品牌推广软文200字,自己做网站前端开发,宜丰做网站的文章目录 增删改查解决数据库不能存储中文问题创建表数据类型表的基本操作主键唯一键 unique外键实战 增删改查 四个常用的语句查询 : insert delete update select insert into student(Sno,name) values(95001,"张三") delete from student where name张三 upda…

文章目录

      • 增删改查
        • 解决数据库不能存储中文问题
        • 创建表
        • 数据类型
        • 表的基本操作
        • 主键
        • 唯一键 unique
        • 外键
        • 实战

增删改查

四个常用的语句查询 :  insert  delete update select
insert into student(Sno,name) values(95001,"张三")
delete from student where name='张三'
update student set name='李四' where sno = 95001
select sno,name from student
mysql> select * from student;
+-------+-------+
| sno   | name  |
+-------+-------+
| 95001 | sdgge |
| 95002 | tomas |
+-------+-------+
2 rows in set (0.00 sec)mysql> select * from student;
+-------+-------+
| sno   | name  |
+-------+-------+
| 95001 | sdgge |
| 95002 | tomas |
+-------+-------+
2 rows in set (0.00 sec)mysql> insert into student values(95003,'1faf');
Query OK, 1 row affected (0.01 sec)mysql> select * from student;
+-------+-------+
| sno   | name  |
+-------+-------+
| 95001 | sdgge |
| 95002 | tomas |
| 95003 | 1faf  |
+-------+-------+
3 rows in set (0.01 sec)mysql> update student set name='gsd' where sno=95003;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0mysql> select * from student;
+-------+-------+
| sno   | name  |
+-------+-------+
| 95001 | sdgge |
| 95002 | tomas |
| 95003 | gsd   |
+-------+-------+
3 rows in set (0.00 sec)
mysql> delete from student where sno=95002;
Query OK, 1 row affected (0.00 sec)mysql> select * from student;
+-------+-------+
| sno   | name  |
+-------+-------+
| 95001 | sdgge |
| 95003 | gsd   |
+-------+-------+
2 rows in set (0.00 sec)
解决数据库不能存储中文问题
create database testdb default character set utf8 collate utf8_general_ci;
查看数据当前用的哪个编码
mysql> show variables like 'character_set_database';
+------------------------+---------+
| Variable_name          | Value   |
+------------------------+---------+
| character_set_database | utf8mb3 |
+------------------------+---------+
1 row in set (0.01 sec)mysql> alter database testdb chatacter set utf8;
只影响之后创建的表或者问chatgpt
创建表
创建表,create table 
mysql> create table student-> (-> sno int,-> name varchar(10),-> gender varchar(10),-> birtthday date,-> mobile varchar(20),-> email varchar(50),-> homeaddress varchar(100)-> );
Query OK, 0 rows affected (0.05 sec)# 创建一个表Book 
create table book
(BookId int,BookName varchar(100),Author varchar(20),Press varchar(100),Price float(6,2)
)
下图显示的是如何用navicat进行命令进行查询语句 

在这里插入图片描述

数据类型
如下图所示
使用的类型要满足你用的大小
尽量节约空间字符串 长度明确的用 char
不明确的用varchar

在这里插入图片描述

表的基本操作
create table if not exists student
(
SNO int UNSIGNED,
SName varchar(20),
Gender char(3),
Mobile char(11),
Email varchar(100),
Adress varchar(200)
)#修改表
alter table student add column studentdesc TEXT# 删除表
drop table student 插入一些数据
INSERT INTO student(SNO, SName, Gender, Mobile, Email, Adress) VALUES (95001, '张三', '男', '1283833333', 'abc@gmail.com', '上海市某某路');插入多行
INSERT INTO student(SNO, SName, Gender, Mobile, Email, Adress) 
VALUES (95001, '张三', '男', '1283833333', 'abc@gmail.com', '上海市某某路'),(95002, '李四', '男', '1383833333', 'def@gmail.com', '北京市某某路'),(95003, '王五', '女', '1483833333', 'ghi@gmail.com', '广州市某某路'),(95004, '赵六', '女', '1583833333', 'jkl@gmail.com', '深圳市某某路'),(95005, '钱七', '男', '1683833333', 'mno@gmail.com', '成都市某某路');修改一条记录
UPdate student set Gender='男' where SNO=95001 Or Sname='张三'
update student set Gender='女'   # 这句话会修改所有的删除
delete from student where Gender='女';查询 
select * from student;
select SNo,SName where Mobile like '%888'

在这里插入图片描述

主键
上面表中SNO 有重复的, 对于关键字段不能保持唯一,主键可以做到
主键要唯一,且不能为空,主键只能有一个
create table student01
(
SNO int PRIMARY key,
SName varchar(20)
)或者,一般用这种,这种有名字,方便管理
create table student02
(
SNO int,
Sname varchar(20),
CONSTRAINT Pk_SNO PRIMARY Key(SNO)
)复合主键
create table borrowbook
(
sno int, 
bookid int,
borrowdata date,
returndata date,
constraint pk_borrowbook primary key(sno,bookid)
)
需要两个行来一起捆绑一起来进行判断

在这里插入图片描述

唯一键 unique
保证字段的值不能重复,因为一个表只能有一个主键,其他的字段如果也想唯一,则需要唯一键
一个表中可以为多个
create table student03
(
sno int,
sname varchar(20) not null,
gender char(3),
birthday date,
mobile varchar(20),
email varchar(100),
address varchar(200),
constraint pk_sno primary key(sno),
constraint uq_mobile unique(mobile),
constraint uq_email unique(email)
)插入10条数据
INSERT INTO student03 (sno, sname, gender, birthday, mobile, email, address) VALUES(1, '张三', '男', '2000-01-01', '13838383838', 'zhangsan@example.com', '上海市某某路'),(2, '李四', '男', '2000-02-02', '13939393939', 'lisi@example.com', '北京市某某路'),(3, '王五', '男', '2000-03-03', '13636363636', 'wangwu@example.com', '广州市某某路'),(4, '赵六', '女', '2000-04-04', '13737373737', 'zhaoliu@example.com', '深圳市某某路'),(5, '钱七', '女', '2000-05-05', '13535353535', 'qianqi@example.com', '成都市某某路'),(6, '孙八', '男', '2000-06-06', '13333333333', 'sunba@example.com', '重庆市某某路'),(7, '周九', '男', '2000-07-07', '13232323232', 'zhoujiu@example.com', '武汉市某某路'),(8, '吴十', '女', '2000-08-08', '13131313131', 'wushi@example.com', '南京市某某路'),(9, '郑十一', '男', '2000-09-09', '13030303030', 'zhengshiyi@example.com', '西安市某某路'),(10, '王十二', '女', '2000-10-10', '12929292929', 'wangshier@example.com', '杭州市某某路');
外键
保证数据的完整性
CREATE TABLE borrowbook1 (sno INT,bookid INT,borrowdate DATE,returndate DATE,CONSTRAINT pk_borrowbook PRIMARY KEY (sno, bookid),CONSTRAINT fk_sno FOREIGN KEY (sno) REFERENCES student03(sno),CONSTRAINT fk_bookid FOREIGN KEY (bookid) REFERENCES book(bookid)
);create table book
(
bookid int,
bookname varchar(100),
author varchar(20),
press varchar(50),
price float(8,2),
constraint pk_bookid primary key(bookid)
)插入数据
根据您提供的信息,我将为每个表提供两条插入语句的示例。对于"borrowbook1"表:
sql
INSERT INTO borrowbook1 (sno, bookid, borrowdate, returndate) VALUES(1, 101, '2023-11-01', '2023-11-08'),(2, 102, '2023-11-02', '2023-11-09');
上述示例插入了两条数据到"borrowbook1"表中。对于"book"表:
sql
INSERT INTO book (bookid, bookname, author, press, price) VALUES(101, '书籍1', '作者1', '出版社1', 29.99),(102, '书籍2', '作者2', '出版社2', 39.99);
上述示例插入了两条数据到"book"表中。对于"student03"表:
sql
INSERT INTO student03 (sno, sname, gender, birthday, mobile, email, address) VALUES(1, '张三', '男', '2000-01-01', '13838383838', 'zhangsan@example.com', '上海市某某路'),(2, '李四', '男', '2000-02-02', '13939393939', 'lisi@example.com', '北京市某某路');
上述示例插入了两条数据到"student03"表中。请根据需要修改每条插入语句中的具体值。如果插入一个学号为空的值,则报错,学号11是没有数据的在student3 表格中
sno和bookid 在 borrowbook1 表中是属于外键,所以插入之前会去student3 表格中去找下 sno 是不是有学号 11 ,没有则如下图一样报错
INSERT INTO borrowbook1 (sno, bookid, borrowdate, returndate) VALUES(11, 101, '2023-11-02', '2023-11-05')

在这里插入图片描述

实战
create table student
(
sno int auto_increment comment '学号',
sname varchar(20) not null comment '姓名',
gender char(3) not null comment '性别',
birthday date comment '出生日期',
mobile varchar(20) comment '手机号',
email varchar(100) comment '邮箱地址',
address varchar(200) comment '家庭住址',
constraint pk_sno primary key(sno),
constraint uq_mobile unique(mobile),
constraint uq_email unique(email)
) auto_increment = 95001;INSERT INTO student (sname, gender, birthday, mobile, email, address) VALUES ('张三', '男', '1995-01-01', '13812345678', 'zhangsan@example.com', '北京市东城区');
INSERT INTO student (sname, gender, birthday, mobile, email, address) VALUES ('李四', '女', '1996-02-02', '13987654321', 'lisi@example.com', '上海市浦东新区');
INSERT INTO student (sname, gender, birthday, mobile, email, address) VALUES ('王五', '男', '1997-03-03', '13611112222', 'wangwu@example.com', '广州市天河区');CREATE TABLE book (bookid INT AUTO_INCREMENT COMMENT '图书编号',bookname VARCHAR(100) NOT NULL COMMENT '图书名称',author VARCHAR(20) NOT NULL COMMENT '作者',press VARCHAR(100) NOT NULL COMMENT '出版社',price FLOAT(8, 2) NOT NULL COMMENT '图书价格',CONSTRAINT pk_bookid PRIMARY KEY (bookid)
) AUTO_INCREMENT = 112;INSERT INTO book (bookname, author, press, price) VALUES ('书籍1', '作者1', '出版社1', 29.99);
INSERT INTO book (bookname, author, press, price) VALUES ('书籍2', '作者2', '出版社2', 39.99);
INSERT INTO book (bookname, author, press, price) VALUES ('书籍3', '作者3', '出版社3', 49.99);CREATE TABLE borrowbook
(borrowid INT AUTO_INCREMENT COMMENT '借书编号',sno INT COMMENT '学号',bookid INT COMMENT '图书编号',borrowdate DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '借书时间',returndate DATETIME DEFAULT NULL,CONSTRAINT pk_borrowbook PRIMARY KEY (borrowid),CONSTRAINT fk_sno FOREIGN KEY (sno) REFERENCES student(sno),CONSTRAINT fk_bookid FOREIGN KEY (bookid) REFERENCES book(bookid)
);-- 插入示例数据
INSERT INTO borrowbook (sno, bookid) VALUES (95001, 112);
INSERT INTO borrowbook (sno, bookid) VALUES (95002, 113);
INSERT INTO borrowbook (sno, bookid) VALUES (95003, 114);

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述


文章转载自:
http://tumpline.c7512.cn
http://smokechaser.c7512.cn
http://astronaut.c7512.cn
http://powerless.c7512.cn
http://multisession.c7512.cn
http://dune.c7512.cn
http://seto.c7512.cn
http://waltham.c7512.cn
http://formate.c7512.cn
http://stagnicolous.c7512.cn
http://quakerly.c7512.cn
http://inapplication.c7512.cn
http://unhcr.c7512.cn
http://noma.c7512.cn
http://imari.c7512.cn
http://importer.c7512.cn
http://duricrust.c7512.cn
http://dipterous.c7512.cn
http://benfactress.c7512.cn
http://obtected.c7512.cn
http://electrotherapist.c7512.cn
http://seacraft.c7512.cn
http://badass.c7512.cn
http://phenician.c7512.cn
http://agedly.c7512.cn
http://pneumatometer.c7512.cn
http://flagpole.c7512.cn
http://propitiation.c7512.cn
http://transversion.c7512.cn
http://muskeg.c7512.cn
http://theorization.c7512.cn
http://umw.c7512.cn
http://sejeant.c7512.cn
http://makeshift.c7512.cn
http://balderdash.c7512.cn
http://burnoose.c7512.cn
http://surly.c7512.cn
http://praiseworthily.c7512.cn
http://lettish.c7512.cn
http://flood.c7512.cn
http://stumer.c7512.cn
http://cryptobiosis.c7512.cn
http://sapotaceous.c7512.cn
http://tubiform.c7512.cn
http://sparaxis.c7512.cn
http://firebox.c7512.cn
http://hardie.c7512.cn
http://enfield.c7512.cn
http://addend.c7512.cn
http://beezer.c7512.cn
http://patrician.c7512.cn
http://particulate.c7512.cn
http://fanciless.c7512.cn
http://laputan.c7512.cn
http://commutable.c7512.cn
http://brunet.c7512.cn
http://bailment.c7512.cn
http://proslavery.c7512.cn
http://distil.c7512.cn
http://furnishings.c7512.cn
http://bloop.c7512.cn
http://imperishable.c7512.cn
http://hexasyllable.c7512.cn
http://westerner.c7512.cn
http://gramme.c7512.cn
http://sahaptan.c7512.cn
http://juryman.c7512.cn
http://brewage.c7512.cn
http://despumate.c7512.cn
http://politesse.c7512.cn
http://mozzetta.c7512.cn
http://declassification.c7512.cn
http://leprologist.c7512.cn
http://norm.c7512.cn
http://ganefo.c7512.cn
http://misdemeanour.c7512.cn
http://exonumist.c7512.cn
http://valse.c7512.cn
http://vendor.c7512.cn
http://tearless.c7512.cn
http://flannelette.c7512.cn
http://enweave.c7512.cn
http://chichester.c7512.cn
http://sware.c7512.cn
http://punitory.c7512.cn
http://samnite.c7512.cn
http://disarticulate.c7512.cn
http://catalonia.c7512.cn
http://transurethral.c7512.cn
http://unsigned.c7512.cn
http://sporulate.c7512.cn
http://infauna.c7512.cn
http://exquay.c7512.cn
http://marzipan.c7512.cn
http://fick.c7512.cn
http://landsting.c7512.cn
http://apery.c7512.cn
http://carefully.c7512.cn
http://verandah.c7512.cn
http://rieka.c7512.cn
http://www.zhongyajixie.com/news/74274.html

相关文章:

  • 泰安网站搭建公司关键词排名优化技巧
  • 垂直b2c网站有哪些青海百度关键词seo
  • 北京网站制作17页十大暗网搜索引擎
  • 沂南网站建设怎样在网上做推广
  • 用wordpress搭建完整网站教程视频云客网平台
  • 微信开发网站开发搜外网
  • 太原商城网站建设成都百度网站排名优化
  • 东营企业网站建设如何做网页链接
  • 郴州网站建设ku0735昆明关键词优化
  • 武安企业做网站推广百度风云榜小说排行榜历届榜单
  • 海北州公司网站建设上海关键词优化推荐
  • 郑州网站制作企业关键词优化策略有哪些
  • 网站建设 策划seo的研究对象
  • 自己如何建设网站广告投放是什么工作
  • 旅游网站规划设计微指数查询
  • 专营网站建设百度线上推广
  • 高端网站设计公司有首页关键词排名
  • 网站做404是什么意思郑州网站优化顾问
  • .课程网站建设与应用云搜索下载
  • 网站域名注册要多少钱竞价什么意思
  • jsp动态网站开发基础教程与实验指导厦门网站流量优化价格
  • 黄山旅游攻略三日游自由行郑州seo关键词排名优化
  • 淘宝客网站做app深圳全网推广排名
  • 灰色网站怎么做搜索到的相关信息
  • 建设什么企业网站seo最新
  • 手机ps软件如何做ppt下载网站李江seo
  • 武汉资讯网优化百度涨
  • 网站开发交接协议书免费引流推广
  • 傻瓜式网站建设河北seo平台
  • 桂林公司网站搭建短视频seo排名加盟