資料庫基本命令,整理

2022-09-03 10:27:12 字數 1066 閱讀 1778

#啟動mysql伺服器

net start mysql

#關閉

net stop mysql

#進入mysql -h 主機位址 -u 使用者名稱 -p 使用者密碼

#退出exit

#顯示資料庫

show databases;

create database wpj1105;

#刪除資料庫

drop database wpj1105;

#使用該資料庫

use 資料庫;

#建立表

create table 表名 (欄位名 資料型別 [約束條件],

欄位名 資料型別 [約束條件],
欄位名 資料型別 [約束條件],
欄位名 資料型別 [約束條件],

........)

#刪除資料

drop table 資料庫名;

delete from 表名 [where 條件語句]

#查詢表中的資料

select * from 表名;

select 欄位名 from 表名;

#更新資料

update 表名 set 列名 1 = 值,列名 2 = 值,.....[where 條件表示式]

#新增資料

insert into 表明(列名1,列名2....) values (值1,值2,.....);

資料庫基本命令

增刪改查 select 從資料庫中提取資料 update 更新資料庫中的資料 delete 從資料庫中刪除資料 insert into 向資料庫中插入新資料 唯一性查詢 sql select distinct 插入語句 insert into websites name,url,alexa,coun...

Linux mysql資料庫基本命令

一 啟動及登入mysql 1 linux下啟動mysql的命令 mysqladmin start ect init.d mysql start 前面為mysql的安裝路徑 2 linux下重啟mysql的命令 mysqladmin restart ect init.d mysql restart 前...

資料庫的基本命令

create database databasenameon name datebasename data,資料檔案的邏輯檔名 filename 該資料檔案的儲存路徑 datebasename data.mdf size 10,檔案初始大小,單位為m maxsize 50 檔案最大值 filegro...