【正文】
lect * from stu where EQ=80 or EQ=90。姓名,性別,年齡,課程 導(dǎo)出sql腳本mysqldump stu uroot p 查看表的結(jié)構(gòu)desc tablename 修改表中的數(shù)據(jù)update tablename set colname=value where條件 刪除數(shù)據(jù)delete from teacher where age=? 刪除表中所有數(shù)據(jù)delete from teacher; 刪除表drop table tablename 根據(jù)條件進(jìn)行過(guò)濾查找select *from tablename where 條件 查找出版社為“清華出版社”的所有書籍select *from books where pub=‘清華出版社’; 查找出庫(kù)存大于50的所有書籍select *from books where store50; 查找出“西游記”的庫(kù)存量select title,store from books where title=‘西游記’; SQL運(yùn)算符 大于 小于 =大于等于 =小于等于 !=,不等于 查看數(shù)據(jù)庫(kù)的信息\s mysql常用函數(shù) 查看數(shù)據(jù)庫(kù)版本select versin(); 計(jì)算機(jī)的時(shí)間是存在BIOS() 查看當(dāng)前數(shù)據(jù)庫(kù)的日期select current_date(); 查看當(dāng)前數(shù)據(jù)庫(kù)時(shí)間select now(); 查看當(dāng)前連接數(shù)據(jù)庫(kù)的用戶select user();localhost:代表是本機(jī) create table user(id int,name varchar(20),bir date,dea datetime)。BLOB是一個(gè)能保存二進(jìn)制數(shù)據(jù)的大對(duì)象,區(qū)別是TEXT不區(qū)分大小寫,而BLOB區(qū)分大小寫。 完美WORD格式 數(shù)據(jù)庫(kù)學(xué)習(xí)入門數(shù)據(jù)庫(kù)基礎(chǔ)入門 數(shù)據(jù)庫(kù)學(xué)習(xí)入門數(shù)據(jù)庫(kù)基礎(chǔ)入門 數(shù)據(jù)庫(kù)的作用: 數(shù)據(jù)是數(shù)據(jù)庫(kù)中存儲(chǔ)的基本對(duì)象 包括:文字、圖形、圖像、聲音 有組織的、可共享的數(shù)據(jù)集合 常用的DBMS MYSQL(oracle、Sun) oracle(oracle) SQLServer(Microsoft) DB2(IBM) ..如何學(xué)習(xí)數(shù)據(jù)庫(kù)管理系統(tǒng) .程序員 標(biāo)準(zhǔn)語(yǔ)言:SQL(結(jié)構(gòu)化查詢語(yǔ)言) SQL是用于訪問(wèn) 數(shù)據(jù)庫(kù)的最常用標(biāo)準(zhǔn)化語(yǔ)言,他是由ANSI/ISO SQL標(biāo)準(zhǔn)定義的 SQL 的分類 DML:數(shù)據(jù)操作語(yǔ)言(用于檢索或者修改數(shù)據(jù)) DDL:數(shù)據(jù)定義語(yǔ)言(用于定義數(shù)據(jù)的結(jié)構(gòu),比如創(chuàng)建、修改或者刪除數(shù)據(jù)庫(kù)的對(duì)象) DCL:數(shù)據(jù)控制語(yǔ)言(用于定義數(shù)據(jù)庫(kù)用戶的權(quán)限) DML: select:用于檢索數(shù)據(jù) insert:用于增加數(shù)據(jù)到數(shù)據(jù)庫(kù) update:用于從數(shù)據(jù)庫(kù)中修改現(xiàn)存的數(shù)據(jù) delete:用于從數(shù)據(jù)庫(kù)中刪除數(shù)據(jù) DDL: create table //創(chuàng)建表 alter //修改表 drop table //刪除表 create index //創(chuàng)建索引 drop index //刪除索引 create view //創(chuàng)建視圖 drop view //刪除視圖 DCL: grant //授權(quán) revoke //撤銷授權(quán) set //設(shè)置 不同數(shù)據(jù)庫(kù)的獨(dú)特管理方式 .DBA(Database Administrator) 標(biāo)準(zhǔn)語(yǔ)言:SQL(結(jié)構(gòu)化查詢語(yǔ)言) 不同數(shù)據(jù)庫(kù)的獨(dú)特管理方式 數(shù)據(jù)庫(kù)的調(diào)優(yōu) 精通數(shù)據(jù)庫(kù)的備份、回復(fù)機(jī)制 MYSQL的安裝與配置 安裝:選擇普通安裝類型 .配置 選擇配置類型:Detailed Configuration 選擇服務(wù)器類型:Developer Machine 選擇數(shù)據(jù)庫(kù)的是使用情況: 多功能數(shù)據(jù)庫(kù)(Multifunctional Database) 只是事務(wù)處理數(shù)據(jù)庫(kù)(Transactional Database Only) 只是非事務(wù)處理數(shù)據(jù)庫(kù)(NonTransactional Database Only) InnoDB表空間文件存儲(chǔ)的盤符,默認(rèn)在c:\ 數(shù)據(jù)庫(kù)并發(fā)連接數(shù)配置:Decision support MYSQL服務(wù)器端口:默認(rèn):3306 Enable Strict Mode:是否允許嚴(yán)格樣式檢查:取消 選擇字符編碼:手工選擇:gb2312,windows下中文支持 服務(wù)器默認(rèn)安裝到windows系統(tǒng)服務(wù)中,默認(rèn)服務(wù)自啟動(dòng),選擇自動(dòng)配置環(huán)境變量 填寫數(shù)據(jù)庫(kù)管理系統(tǒng)的管理員密碼 在mySQL中數(shù)據(jù)庫(kù)管理員的用戶名為:root 1是否允許使用root用戶遠(yuǎn)程登錄數(shù)據(jù)庫(kù) 1測(cè)試配置是否正確c:\c:\mysql\bin\mysqlshow MYSQL 的登錄 .開始運(yùn)行cmd .輸入:mysql uroot p,然后輸入密碼 .或者:mysql uroot p密碼 .退出quit或者\(yùn)q 不必全在一個(gè)行內(nèi)給出一個(gè)命令,較長(zhǎng)命令可以輸入到多個(gè)行中。 TEXT/BLOB 文本和大對(duì)象 TEXT可以保存字符串的長(zhǎng)度在25565535字節(jié)內(nèi)。老師表:teacher amp。,now(),now())。 in(x,x)返回條件中的記錄與or作用相似 select * from tablename where 條件 in(,); between‘’ and‘’返回兩者之間的記錄 查詢年齡在2030之間的所有學(xué)生 select * from stu where age between 20 and 30; like與通配符(%)一起使用,模糊查詢 查找出姓張的學(xué)生 select * from stu where name like ‘張%’; 查詢出使用163郵箱的所有學(xué)生 select * from stu where like ‘’; 查詢出郵箱里面含有a的所有學(xué)生 select * from stu where like ‘%a%’; order by 實(shí)現(xiàn)排序(從小到大)asc 將學(xué)生的年齡從高到低排列 select * from stu order by age desc;(降序) 將學(xué)生的年齡從低到高排列 select * from stu order by age asc;(升序) 數(shù)據(jù)默認(rèn)為升序(從低到高) select * from stu order by age ; as為查詢的列起別名 查詢所有學(xué)生只列出姓名,年齡,性別 select name as 39。,sex as 39。xxx39。 count 查看表中有幾條數(shù)據(jù) select count(*) from stu。 select * from stu limit 3,3。 insert into test values(1)。 insert into test values()。 id主鍵自增,減 create table test (id int,name varchar(20),primary key(id));