use 庫名
創(chuàng)新互聯(lián)公司專注于企業(yè)網(wǎng)絡(luò)營銷推廣、網(wǎng)站重做改版、富裕網(wǎng)站定制設(shè)計、自適應(yīng)品牌網(wǎng)站建設(shè)、H5開發(fā)、商城網(wǎng)站建設(shè)、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)營銷網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計等建站業(yè)務(wù),價格優(yōu)惠性價比高,為富裕等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。
go -----打開庫
create table 學(xué)生信息
(學(xué)號 int not null,
姓名 char(10) not null,
班級 nvarchar(20)
成績 int )
go -----這是建表
(1)insert into 學(xué)生信息(學(xué)號,姓名,班級,成績)
values('122153032','小靜',‘計應(yīng)123’,'99') ----這是插入記錄以此類推插入五條
(2)select *
from 學(xué)生信息
where 成績85 -----顯示成績大于85分的學(xué)生信息
(3) select *
from 學(xué)生信息
order by 成績desc ---將表中的所有記錄,按照成績從小到大順序排列
能幫你的只有這些,望采納!
create table student
(sno int primary key not null,
sname varchar(20) not null,
ssex char(2) check(ssex='男' or ssex='女') not null,
sage tinyint null,
sdept varchar(20) null )
通過create table語句建立用戶表,字段按學(xué)生個人信息添加,然后用insert語句存入數(shù)據(jù)。
create
database
cookbook;
創(chuàng)建一個叫“cookbook”的數(shù)據(jù)庫
use
cookbook;
使用cookbook這個數(shù)據(jù)庫
create
table
limbs
(thing
varchar(20),legs
int,arms
int);
創(chuàng)建表“l(fā)imbs”其中包括thing,legs,aems
字段
創(chuàng)建表的命令是
create
table
表名稱
后面括號里的內(nèi)容是表中字段的屬性
1、使用 create table 語句可完成對表的創(chuàng)建, create table 的創(chuàng)建形式:
create table 表名稱(列聲明);
以創(chuàng)建 people 表為例, 表中將存放 學(xué)號(id)、姓名(name)、性別(sex)、年齡(age) 這些內(nèi)容:
create table people(
id int unsigned not null auto_increment primary key,
name char(8) not null,
sex char(4) not null,
age tinyint unsigned not null
);
其中,auto_increment就可以使Int類型的id字段每次自增1。
2、向表中插入數(shù)據(jù)使用insert 語句。
insert 語句可以用來將一行或多行數(shù)據(jù)插到數(shù)據(jù)庫表中, 使用的一般形式如下:
insert [into] 表名 [(列名1, 列名2, 列名3, ...)] values (值1, 值2, 值3, ...);
其中 [] 內(nèi)的內(nèi)容是可選的, 例如, 要給上步中創(chuàng)建的people 表插入一條記錄, 執(zhí)行語句:
insert into people(name,sex,age) values( "張三", "男", 21 );
3、想要查詢是否插入成功,可以通過select 查詢語句。形式如下:
select * from people;
擴(kuò)展資料:
當(dāng)mysql大批量插入數(shù)據(jù)的時候使用insert into就會變的非常慢,?mysql提高insert into 插入速度的方法有三種:
1、第一種插入提速方法:
如果數(shù)據(jù)庫中的數(shù)據(jù)已經(jīng)很多(幾百萬條), 那么可以?加大mysql配置中的 bulk_insert_buffer_size,這個參數(shù)默認(rèn)為8M
舉例:bulk_insert_buffer_size=100M;
2、第二種mysql插入提速方法:
改寫所有 insert into 語句為?insert?delayed into
這個insert delayed不同之處在于:立即返回結(jié)果,后臺進(jìn)行處理插入。
3、第三個方法: 一次插入多條數(shù)據(jù):
insert中插入多條數(shù)據(jù),舉例:
insert into table values('11','11'),('22','22'),('33','33')...;
當(dāng)前文章:mysql怎么創(chuàng)建學(xué)生表 數(shù)據(jù)庫怎么創(chuàng)建學(xué)生表
文章地址:http://m.kartarina.com/article2/hjghic.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)網(wǎng)站制作、網(wǎng)站改版、用戶體驗、建站公司、手機(jī)網(wǎng)站建設(shè)、品牌網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)