SQL Server資料庫初步

2021-07-30 07:33:25 字數 825 閱讀 8259

今天安裝了sql server 2008,然後又複習了一些基本查詢語句。

--建立資料庫

create database hero

--建立表

use hero --制定資料庫

gocreate table heros

(heroid int ,--編號

heroname varchar(50) , --姓名

nickname varchar (50), --花名

*** char(2),

sal int

) --增加資料

insert into heros values(1,'宋江','及時雨','男',30000)

insert into heros values(2,'盧俊義','玉麒麟','男',4000)

insert into heros values(3,'吳用','智多星','男',500)

insert into heros values(4,'公松勝','入雲龍','男',80)

--查詢

select * from heros

--刪除表單

drop table heros

--1.查詢工資低於100的員工

select * from heros where sal<100

--2.把工資高於100的人統統降低10%

update heros set sal=0.9*sal where sal>100

--3.刪除性別為女的同志

delete from heros where ***='女'

資料庫初步

建立乙個表people,id列設為主鍵,且自動遞增 在mysql中,create people id int not null primary key auto increment,name varchar 20 varchar 20 在sql server中 create table people...

資料庫初步學習

mysql資料庫基本操作 前段時間自學了資料庫的基本操作,寫點總結撒 一.資料庫檔案操作 1.建立資料庫檔案 create database 資料庫名稱 2.刪除資料庫檔案 drop database 資料庫名稱 3.顯示資料庫檔案 show databases 4.開啟資料庫檔案 use 資料庫名...

資料庫學習初步學習

select from web insert into web name,url,alexa,country values 13,cn insert into web name,url,alexa,country values 菜鳥教程 4689,cn insert into web name,ur...