資料庫幾個基本操作

2021-04-13 01:07:48 字數 1224 閱讀 2461

建:create table [meiju] (

[mj_id] [int]  not null,

[mj_name] [nchar]  null,

[mj_season] [int]  null,

[mj_num] [int]  null,

[mj_type] [nchar]  null,

[mj_address] [nchar]  null)

插:create procedure up_meiju_add

@mj_id int ,

@mj_name nchar(510) ,

@mj_season int ,

@mj_num int ,

@mj_type nchar(510) ,

@mj_address nchar(510) 

as insert into meiju(

[mj_id],[mj_name],[mj_season],[mj_num],[mj_type],[mj_address]

)values(

@mj_id,@mj_name,@mj_season,@mj_num,@mj_type,@mj_address)改:

create procedure up_meiju_update

@mj_id int,

@mj_name nchar(510),

@mj_season int,

@mj_num int,

@mj_type nchar(510),

@mj_address nchar(510)

as update meiju set

[mj_id] = @mj_id,[mj_name] = @mj_name,[mj_season] = @mj_season,[mj_num] = @mj_num,[mj_type] = @mj_type,[mj_address] = @mj_address

where [id] = @id

查:create procedure up_meiju_getlist

as select

[mj_id],[mj_name],[mj_season],[mj_num],[mj_type],[mj_address]

from meiju

刪:create procedure up_meiju_delete

@id int

as delete meiju

where [id] = @id

資料庫 資料庫基本操作

操作練習 修改表結構 表資料的操作 實現 1 建立表 create table student stu no char 12 not null primary key,stu name varchar 20 not null gender tinyint 1 default1,age tinyint...

資料庫基本操作

1.查詢一周之內的資料 select from 表名 where date sub curdate interval 7 day date 欄位名 2.插入 年 月 日 時 分 秒的時間 pstmt.settimestamp 7,new timestamp system.currenttimemil...

資料庫基本操作

登入資料庫系統 mysql h localhost u root p 檢視已存在的資料庫 show databases 檢視預設儲存引擎 show variables like storage engine 建立資料庫 create database 想建立的資料庫名字 刪除資料庫 drop dat...