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

自己建的网站如何百度搜索网站应用软件怎么架设

自己建的网站如何百度搜索,网站应用软件怎么架设,网站建设模板之家免费下载,石嘴山网站建设公司一、Mysql软件使用 1.启动/停止Mysql服务器 任务管理器 cmd命令:以管理员的身份打开cmd命令行 net start mysql80//开启net stop mysql80//停止 2.连接与断开Mysql服务器 注意要在bin目录下执行:-u用户名root,-p密码 mysql -u root -p 可能出现的…

 一、Mysql软件使用

1.启动/停止Mysql服务器

任务管理器

cmd命令:以管理员的身份打开cmd命令行

net start mysql80//开启net stop mysql80//停止 

2.连接与断开Mysql服务器

注意要在bin目录下执行:-u用户名root,-p密码

mysql -u root -p

可能出现的问题:

配置环境变量-右键此电脑——>点击属性——>高级设置——>系统属性——>用户变量新建——>复制Mysql的bin目录地址即可

 另一个是我遇到的,推荐这个博主文章:关于Can't connect to MySQL server on 'localhost:3306' (10061)问题-http://t.csdnimg.cn/gjGFK

退出:

quit;

 二、数据库与表结构操作

1.对数据库的操作

数据库的创建:

create database test;create schema test1;//与上一句都是创建数据库create database test2
character set=gbk;//创建时可设置编码格式-汉字编码create database if not exists test;//创建时可先进行判断

修改数据库:

 alter database 数据库名default character set gbk//修改字符集编码为gbkdefault collate gbk_chinese_ci;//修改字符集校对规则编码为gbk,字符集编码必须要一致

删除数据库:

 drop database 数据库名;

选择数据库:

use 数据库名;

2.数据类型

数据库中的数据类型对应C语言中的数据类型

tinyint---1个字节:-128~127;unsigned-0~255
smallint---2个字节:
int---4个字节:
bigint---8个字节:相当于long型
float(5,2)---4个字节:表示共5个数字长度,有2个小数位
unsigned表示无符号类型,即正数
char-定长字符类型,长度固定;varchar-变长字符串类型,按实际长度存储
tinytext--存储短文本字符串date---年月日YYYY-MM-DD;time---时分秒HH:MM:SS
datetime---date+time

3.表结构操作

alter table t_table1 add detail tinytext ;-- 添加新属性/字段
alter table t_table1 modify detail varchar(20) ; -- 修改属性类型/字段
alter table t_table1 change detail details varchar(20) ; -- 修改属性名/字段
alter table t_table1 drop column details;--  删除字段
rename table t_table1 to table1;-- 修改表名 
drop table if exists test;-- 删除表 

三、多表操作

1.多表设计

一对多:部门与员工

create table labor(
id int unsigned primary key auto_increment,
username varchar(20) not null,
gender tinyint unsigned not null,
departure_id int unsigned,
create_time datetime not null) comment '员工表';create table departure(
id int unsigned primary key auto_increment,
name varchar(10) not null unique,
create_time datetime not null
) comment '部门表';//对已建表添加联系/约束:一个部门对应多个员工
alter table labor add constraint c1(约束名可任意取) foreign key(departure_id) references departure(id);//创建表时添加联系/约束
create table managers( 
id int unsigned primary key auto_increment,
name varchar(20),
departure_id int unsigned,
labor_id int unsigned,
constraint m1 foreign key(departure_id) references departure(id)) comment '部门经理';//删除约束
alter table managers drop constraint c1(约束名);

一对一:用户与身份证-将单表进行拆分 

create table labor(
id int unsigned primary key auto_increment,
username varchar(20) not null,
gender tinyint unsigned not null,
departure_id int unsigned,
create_time datetime not null) comment '员工表';create table labor_card(
id int unsigned primary key auto_increment,
birthday date not null,
idcard char(18) not null,
labor_id int unsigned not null unique,//一定要加unique,否则不能实现一对一
constraint l1 foreign key (labor_id) references labor(id)
) comment '员工身份信息表';

多对多:学生与课程-借助中间表实现,分别关联两方主键

create table stu(
id int auto_increment primary key,
name varchar(20),
num varchar(10)
) comment '学生表';
insert into stu(name,num) values('湘城','20210133'),('源思','20210522'),('砂峮','20211344'),('信肆','20212345');create table course(
id int auto_increment primary key,
name varchar(20)
) comment '课程表';
insert into course(name) values('C'),('PHP'),('Java');create table stu_cour(
id int auto_increment primary key,
stu_id int not null,
cour_id int not null,
constraint s1 foreign key (stu_id) references stu(id),
constraint s2 foreign key (cour_id) references course(id)
) comment '中间表';
insert into stu_cour(stu_id,cour_id) values(1,2),(1,1),(2,2),(2,3);

2.多表查询

//查询所有
select * from stu,course;-- 笛卡尔积:A、B所有组合情况 ,包括重复记录//内连接查询
select * from stu,course where stu.id=course.id; -- 隐式内连接查询:消除重复记录
select stu.name,course.name from stu,course where stu.id=course.id; -- 查询特定数据
select s.name,c.name from stu s,course c where s.id=c.id; --  给表起别名select * from stu  (inner) join course on stu.id=course.id --  显式内连接查询-inner可省略//外连接查询
select * from stu left join course on stu.id=course.id; -- 左外连接:查询stu表的所有数据及其对应course数据 
select * from stu right join course on stu.id=course.id; -- 右外连接:查询course表的所有数据及其对应stu表的数据 //子查询:嵌套查询
select * from stu where num>(select num from stu where name='湘城'); -- 单行单列
select * from course where id!=(select id from course where name='C')select * from stu where name='源思' or num=20210133 -- 多行单列查询
select * from stu where num in (20210133,20210522)select * from (select * from stu where num>20210522) t1,course where t1.id=course.id -- 多行多列,放在from后作为虚拟表进行查询

http://www.yayakq.cn/news/589215/

相关文章:

  • 婚庆网站建设做易拉宝设计的网站
  • 中国建设银行官方网站 认证seo网站排名的软件
  • 免费提供网站建设网站要挂工商标识怎么做
  • 网站描文本怎么做php网站建设全程解析
  • 怎么建网站不用买空间个人主页网页设计模板
  • 查看网站模板城乡建设主管部门官方网站
  • 网站建设常用代码有限公司怎么纳税
  • 最受欢迎国内设计网站上海外贸仓库
  • 江门网站推广深圳公司玉环网站建设
  • 郑州网站建设兄长好山西电力建设一公司网站
  • 广州市网站建设分站价格360投放广告怎么收费
  • 网站备案申请书上海十大管理咨询公司
  • 怎么查看网站是哪个公司建的买过域名之前就可以做网站了吗?
  • 旅游网站对比模板seo赚钱方式
  • 网站搜索框设计学校网站logo怎么做
  • 虚拟主机怎么设计网站吗猪八戒网设计官网
  • 如何建立一个私人网站开发一个软件大概需要多少钱
  • 徐州网站客户做网站图片软件
  • 做网站 学php哪一部分2017网站icp备案
  • 如何做网站框架花店网站建设需求
  • ps 怎么做网站中国科技成就作文
  • 鲜花网站建设的目标郴州网签备案查询系统
  • 网站怎么做维护做网站需要那些东西
  • 制作营销网站模板导航网站头部代码
  • 信息化建设 网站建设等方面做调查问卷哪个网站好
  • 利用网站宣传腐倡廉建设工作报道个人特种作业证查询
  • 软件开发工具属于哪种类型的软件衡水百度seo
  • 湖北省建设厅官方网站证书查询政工网站建设方案
  • 网站建设的难点在哪里三亚旅游网站建设
  • 网站建设流程包括图片设计软件有哪些