中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

建設(shè)銀行網(wǎng)站功能介紹百度的seo關(guān)鍵詞優(yōu)化怎么弄

建設(shè)銀行網(wǎng)站功能介紹,百度的seo關(guān)鍵詞優(yōu)化怎么弄,淞南網(wǎng)站建設(shè),做產(chǎn)品類網(wǎng)站有哪些DDL語法 DDL(Data Definition Language) 數(shù)據(jù)定義語言,該語言部分包括以下內(nèi)容。 對數(shù)據(jù)庫的常用操作 對表結(jié)構(gòu)的常用操作 修改表結(jié)構(gòu) 對數(shù)據(jù)庫的常用操作 1: 查看當(dāng)前所有的數(shù)據(jù)庫 show databases; 2:創(chuàng)建數(shù)據(jù)庫 create dat…

DDL語法

DDL(Data Definition Language) 數(shù)據(jù)定義語言,該語言部分包括以下內(nèi)容。

  • 對數(shù)據(jù)庫的常用操作

  • 對表結(jié)構(gòu)的常用操作

  • 修改表結(jié)構(gòu)

對數(shù)據(jù)庫的常用操作

1: 查看當(dāng)前所有的數(shù)據(jù)庫

show databases;

2:創(chuàng)建數(shù)據(jù)庫

create database if not exists 數(shù)據(jù)庫名稱;

create database 數(shù)據(jù)庫名稱;

3:選擇使用哪一個(gè)數(shù)據(jù)庫

use 數(shù)據(jù)庫名稱;

4:刪除數(shù)據(jù)庫

drop database 數(shù)據(jù)庫名稱;

drop database if exists 數(shù)據(jù)庫名稱;

5:修改數(shù)據(jù)庫編碼

alter database school character set utf8;

對表結(jié)構(gòu)的常用操作-創(chuàng)建表

1:創(chuàng)建表格式

create table [if not exists] 表名(
? 字段1 類型[(寬度)] [約束條件] [comment '字段說明'],
? 字段2 類型[(寬度)] [約束條件] [comment '字段說明'],
? 字段3 類型[(寬度)] [約束條件] [comment '字段說明'],
)[表的一些設(shè)置];

創(chuàng)建表是構(gòu)建一張空表,指定這個(gè)表的名字,這個(gè)表有幾列,每一列叫什么名字,以及每一列存儲(chǔ)的數(shù)據(jù)類型。

2:數(shù)據(jù)類型

數(shù)據(jù)類型是指在創(chuàng)建表的時(shí)候?yàn)楸碇凶侄沃付〝?shù)據(jù)類型的,只有數(shù)據(jù)符合類型要求才能存儲(chǔ)起來,使用數(shù)據(jù)類型的原則是:夠用就行,盡量使用取值范圍小的,而不用大的,這樣可以更多的節(jié)省存儲(chǔ)空間。

  • 數(shù)值類型

  • 日期和時(shí)間類型

  • 字符串類型

3:數(shù)值類型

create table if not exists student(
? ?-- 無符號(hào) 沒有負(fù)數(shù)
?? sid int unsigned,
?? name varchar(20),
?? gender varchar(20),
?? age int,
?? birthday date,
?? address varchar(20)
);

  • 字符串類型

  • 日期類型

對表結(jié)構(gòu)的其它操作

1:查看當(dāng)前數(shù)據(jù)庫的所有表

show tables ;

2:查看數(shù)據(jù)表的創(chuàng)建語句

show create table 數(shù)據(jù)表名;

3:查看表結(jié)構(gòu)

desc 數(shù)據(jù)表名;

4:刪除表

drop table 數(shù)據(jù)表表名;

5:修改表結(jié)構(gòu)格式

語法格式

alter ?table 表名 add? 列名? 類型(長度) 【約束】;

例子:

為student表添加一個(gè)字段為:系別dept類型為department
alter table student add column dept varchar(20);

6:修改列名和類型

語法格式

修改列名和表名,alter table 表名 change 舊列名 新列名 類型(長度) [約束]

為student表中的dept字段更名為department varchar(30)

alter table student change dept department varchar(30);

7:修改表刪除列

語法格式:

alter table 表名 drop 列名;

例如:

# 刪除student表中department這列
alter table student drop department;

8:修改表名

語法格式:

rename table 表名 to 新表名;

例如:

# 將表student改名為stu
rename table student to stu

DML語法基本介紹

DML是指數(shù)據(jù)操作語言,英文全稱是Data Manipulation Language,用來對數(shù)據(jù)庫中標(biāo)的數(shù)據(jù)幾列進(jìn)行更新。

關(guān)鍵字:

  • 插入Insert

  • 刪除delete

  • 更新update

數(shù)據(jù)插入

  • 語法格式

insert into 表(列名1,列表2,列表3...) values(值1,值2,值3...);// 向表中插入某些
insert into 表 values(值1,值2,值3...);// 向表中插入所有列

例子:

向表中插入所有列

insert into student(sid, name, gender, age, birthday, address,department)
values (1,'tom','男',18,'2000-01-01','鄭州','銷售部');
?insert into student values (2,'jerry','女',28,'2001-01-01','北京','研發(fā)部');

一次性插入多條數(shù)據(jù)

insert into student(sid, name, gender, age, birthday, address,department)
values (3,'tom1','男',18,'2000-01-01','鄭州','銷售部'),

?????????? (4,'corky1','女',18,'2001-01-01','北京','法務(wù)部');
? ? ?
insert into student values (5,'jerry','女',28,'2001-01-01','北京','研發(fā)部'),

???????????????????????????????????????? (6,'yi','男',39,'2002-01-01','上海','研發(fā)部');

數(shù)據(jù)修改

  • 語法格式

update 表名 set 字段名=值,字段名=值...;
update 表名 set 字段名=值,字段名=值... where 條件;

例子:

將所有學(xué)生的地址修改為河南
update student ?set address='河南';
?
將id為1的學(xué)生的地址修改為河南
update student set address='河南' where id=1;
?
將id為2的學(xué)生的地址修改為北京,成績修成績修改為100
update student set address='北京',score=100 where id=2

數(shù)據(jù)刪除

  • 語法格式:

delete from 表名[where 條件];
truncate table 表名 或者truncate 表名

例子:

1:刪除sid為3的學(xué)生數(shù)據(jù)
delete from student where sid=3;
2: 刪除表所有數(shù)據(jù)
delete from student;
3:清空表數(shù)據(jù)
truncate table student;
truncate student;

注意:delete和truncate原理不同,delete只刪除內(nèi)容,而truncate類似于drop table,可以理解為是將整個(gè)表刪除,然后再創(chuàng)建該表。

實(shí)例代碼

?

DQL語法概述

  • 概念

    1. 數(shù)據(jù)庫管理系統(tǒng)一個(gè)重要功能就是數(shù)據(jù)查詢,數(shù)據(jù)查詢不應(yīng)只是簡單返回?cái)?shù)據(jù)庫中存儲(chǔ)的數(shù)據(jù),還應(yīng)該根據(jù)需要對數(shù)據(jù)庫進(jìn)行篩選以及確定數(shù)據(jù)以什么樣的格式顯示。

    2. MySQL提供了功能強(qiáng)大,靈活的語句來實(shí)現(xiàn)這些操作。

    3. MySQL數(shù)據(jù)庫使用select語句來查詢數(shù)據(jù)。

  • 應(yīng)用?

基本查詢

  • 語法格式

select
[all|distinct]
<目標(biāo)列的表達(dá)式1> [別名],
<目標(biāo)列的表達(dá)式2> [別名]...
from <表名或視圖名> [列名],<表名或視圖名> [別名]...
[where<條件表達(dá)式>]
[group by<列名>
[having<條件表達(dá)式>]]
[order by<列名>[asc|desc]]
[limit<數(shù)字或者列表>];

  • 簡化版語法

select *| 列名 from 表 where 條件

  • 數(shù)據(jù)準(zhǔn)備

創(chuàng)建數(shù)據(jù)庫和表

-- 創(chuàng)建數(shù)據(jù)庫
create database if not exist mydb2;
use mydb2;
-- 創(chuàng)建商品表:
create table product(
pid int primary key auto_increment, -- 商品編號(hào)
pname varchar(20) not null , -- 商品名字
price double, ?-- 商品價(jià)格
category_id varchar(20) -- 商品所屬分類
);

  • 添加數(shù)據(jù)

insert into product values(null,'海爾洗衣機(jī)',5000,'c001');
insert into product values(null,'美的冰箱',3000,'c001');
insert into product values(null,'格力空調(diào)',5000,'c001');
insert into product values(null,'九陽電飯煲',200,'c001');
insert into product values(null,'啄木鳥襯衣',300,'c002');
insert into product values(null,'恒源祥西褲',800,'c002');
insert into product values(null,'花花公子夾克',440,'c002');
insert into product values(null,'勁霸休閑褲',266,'c002');
insert into product values(null,'海瀾之家衛(wèi)衣',180,'c002');
insert into product values(null,'杰克瓊斯運(yùn)動(dòng)褲',430,'c002');
insert into product values(null,'蘭蔻面霜',300,'c003');
insert into product values(null,'雅詩蘭黛精華水',200,'c003');
insert into product values(null,'香奈兒香水',350,'c003');
insert into product values(null,'SK-II神仙水',350,'c003');
insert into product values(null,'資生堂粉底液',180,'c003');
insert into product values(null,'老北京方便面',56,'c004');
insert into product values(null,'良品鋪?zhàn)雍Ыz',17,'c004');
insert into product values(null,'三只松鼠堅(jiān)果',88,null);

數(shù)據(jù)準(zhǔn)備

1:創(chuàng)建數(shù)據(jù)庫

create database if not exists mydb2;
use mydb2;

2:創(chuàng)建商品表

create table if not exists product(
?? pid int primary key auto_increment,-- 商品編號(hào)
?? pname varchar(20) ,-- 商品名稱
?? price double, -- 商品價(jià)格
?? category_id int -- 商品所屬分類
);

?alter table product modify category_id varchar(20);

3:添加數(shù)據(jù)

insert into product values(null,'海爾洗衣機(jī)',5000,'c001');
insert into product values(null,'美的冰箱',3000,'c001');
insert into product values(null,'格力空調(diào)',5000,'c001');
insert into product values(null,'九陽電飯煲',200,'c001');
insert into product values(null,'啄木鳥襯衣',300,'c002');
insert into product values(null,'恒源祥西褲',800,'c002');
insert into product values(null,'花花公子夾克',440,'c002');
insert into product values(null,'勁霸休閑褲',266,'c002');
insert into product values(null,'海瀾之家衛(wèi)衣',180,'c002');
insert into product values(null,'杰克瓊斯運(yùn)動(dòng)褲',430,'c002');
insert into product values(null,'蘭蔻面霜',300,'c003');
insert into product values(null,'雅詩蘭黛精華水',200,'c003');
insert into product values(null,'香奈兒香水',350,'c003');
insert into product values(null,'SK-II神仙水',350,'c003');
insert into product values(null,'資生堂粉底液',180,'c003');
insert into product values(null,'老北京方便面',56,'c004');
insert into product values(null,'良品鋪?zhàn)雍Ыz',17,'c004');
insert into product values(null,'三只松鼠堅(jiān)果',88,null);

  • 簡單查詢操作

查詢所有的商品

select * from product;
select pid,pname,price,category_id from product;

查詢商品名和商品價(jià)格

select? price,pname from product;

別名查詢,使用的關(guān)鍵字是as,(as可以省略的)

表別名
? ?select * from product as p;
? ?select * from product p;
? ?select p.id,u.id from product p,user u;

列表名
? ?select pname as 商品名,price as 商品價(jià)格 from product;

去掉重復(fù)值

select distinct price from product;

每一行和每一行都不一樣

select distinct * from product;

查詢結(jié)果是表達(dá)式(運(yùn)算查詢):將所有商品加價(jià)10元進(jìn)行展示

select pname,price+10 as 新價(jià)格,price from product;

運(yùn)算符

  • 算數(shù)運(yùn)算符

  • 比較運(yùn)算符

  • 邏輯運(yùn)算符

  • 位運(yùn)算符

位運(yùn)算符是在二進(jìn)制數(shù)上進(jìn)行計(jì)算的運(yùn)算符。位運(yùn)算會(huì)先將操作數(shù)變成二進(jìn)制數(shù),進(jìn)行位運(yùn)算。然后再將計(jì)算結(jié)果從二進(jìn)制數(shù)變回十進(jìn)制數(shù)。

①:算數(shù)運(yùn)算符

算數(shù)運(yùn)算符

select 6+2;
select 6-2;
select 6*2;
select 6/2;
select 6 div 2;
select 6 mod 2;

將所有商品價(jià)格+10元
select price+10 as 價(jià)格 from product;
?
將所有商品的價(jià)格上調(diào)10%
select price*(1+0.1) as 價(jià)格 from product;

條件查詢

算數(shù)運(yùn)算符

?

代碼實(shí)現(xiàn):

查詢商品名稱為“海爾洗衣機(jī)”的商品所有信息
select * from product where pname='海爾洗衣機(jī)';
?
查詢價(jià)格為800商品
select * from product where price=800;

查詢價(jià)格不是800商品
select * from product where price <>800;
select * from product where price!=800;
select * from product where not (price=800);

查詢商品價(jià)格大于等于60元的所有商品信息
select * from product where price >=60;

查詢商品價(jià)格在200到1000之間所有商品
select * from product where price between 200 and 1000;
select * from product where price >= 200 and price<= 1000;
select * from product where price >= 200 && price<= 1000;

查詢商品價(jià)格在200或800的所有商品
select * from product where price=200 or price=800;
select * from product where price=200 || price=800;
select * from product where price in(200,800);

查詢含有'褲'字的所有商品
select * from product where pname like '%褲%'; -- %任意字符

查詢以‘?!_頭的所有商品
select * from product where pname like '海%';
?
查詢第二個(gè)字為'蔻'的所有商品
select * from product where pname like '_蔻%';
?
查詢category_id為null的商品
select * from product where category_id is null;
?
查詢category_id不為null的商品
select * from product where category_id is not null;

使用Least求取最小值
select LEAST(10,20,30) as small_number;
select least(10,null,30); -- 如果求最小值有一個(gè)null值,不會(huì)比較直接null

使用greatest求最大值
select greatest(10,20,30) as big_number ;
select greatest(10,null,30) as big_number ;
如果求最大值有一個(gè)null值,不會(huì)比較直接null

排序查詢

聚合查詢

?

?

?

聚合函數(shù)--null值得處理

分組查詢

?

分頁查詢

Insert into Select

http://www.risenshineclean.com/news/3472.html

相關(guān)文章:

  • 陜西網(wǎng)站建設(shè)公司哪有網(wǎng)絡(luò)推廣都是收費(fèi)
  • 網(wǎng)絡(luò)優(yōu)化崗位詳細(xì)介紹網(wǎng)絡(luò)優(yōu)化工程師騙局
  • 化妝品網(wǎng)站開發(fā)的背景微信做單30元一單
  • 網(wǎng)站開發(fā)的前后端是哪些搜索引擎營銷的常見方式
  • 廣州微信網(wǎng)站建設(shè)哪家好經(jīng)典軟文案例或軟文案例
  • 美工素材網(wǎng)站有哪些百度北京總部電話
  • 長泰縣建設(shè)局網(wǎng)站電腦培訓(xùn)課程
  • 做網(wǎng)站需要Excel表格嗎國際新聞 軍事
  • 網(wǎng)站改版的宣傳詞湖南網(wǎng)絡(luò)優(yōu)化服務(wù)
  • wordpress做登陸頁面模板林哥seo
  • 做高仿表網(wǎng)站免費(fèi)seo公司
  • 做百度推廣會(huì)送網(wǎng)站嗎線上營銷渠道主要有哪些
  • 現(xiàn)在花錢做那個(gè)網(wǎng)站好呀北京搜索優(yōu)化排名公司
  • 個(gè)人網(wǎng)站能備案嗎中國品牌策劃公司排名
  • 網(wǎng)站建設(shè)報(bào)價(jià)單模板下載如何做好網(wǎng)站的推廣工作
  • 可以做軟件的網(wǎng)站有哪些中文域名注冊管理中心
  • 運(yùn)城網(wǎng)站建設(shè)求職簡歷市場營銷一般在哪上班
  • 中英雙文網(wǎng)站怎么做磁力搜索器下載
  • 合肥做兼職網(wǎng)站開魯seo服務(wù)
  • 如何用dw建立網(wǎng)站互聯(lián)網(wǎng)域名交易中心
  • 關(guān)于做甜品的網(wǎng)站站長工具seo綜合查詢問題
  • 如何做直播網(wǎng)站有沒有專門幫人推廣的公司
  • 上海專業(yè)網(wǎng)站建設(shè)公司電話四川seo多少錢
  • 自己做的網(wǎng)站怎么掛廣告上海百度推廣開戶
  • 東莞廣告公司有哪些長沙seo優(yōu)化公司
  • 北京多用戶商城網(wǎng)站建設(shè)百度愛采購優(yōu)化排名軟件
  • 幫人做網(wǎng)站一個(gè)多少錢網(wǎng)站在線推廣
  • 免費(fèi)企業(yè)網(wǎng)站模板psd站長之家是干什么的
  • 南通快速建站公司公司建網(wǎng)站多少錢
  • 南寧建設(shè)廳網(wǎng)站是什么效果好的關(guān)鍵詞如何優(yōu)化