資料庫常用命令

2021-07-25 21:13:08 字數 1056 閱讀 2957

1、資料表中增加乙個字段:insert into tblstudent (a,b,c,...) values(1,2,3,...);

2、將.sql語句加入到本地資料庫:source  /home/homework/user/zxy/mysql/tblstudent.sql;

3、建立資料庫:create database homework_discuss;

4、根據關鍵字查詢資訊:select * from tblstudent where student_uid=123123\g;

5、按照學生uid降序查詢10個學生資訊:select * from tblstudent order by student_uid desc limit 3\g;

6、更新指定學生的年級資訊:update tblstudent set grade=7 where student_uid=123123;

7、顯示資料庫的建立語句:show create table tblstudent;

9、加入本地資料庫:進入本地資料庫  執行source /home/homework/user/***/tblstudent.sql

10、檢視資料庫授權:show grants for homework@'localhost';localhost可以換成127.0.0.1

11、給資料庫授權:grant all privileges on `homework_teachresource`.* to 'homework'@'localhost' ;

12、檢視資料表字段的含義:show full columns from tblstudent;

13、建立資料庫索引:create index 'ids_a_s_m_c' on tbluseractivity (activity_id,status,nums,create_time);

14、mysql登入命令:mysql -hip -uusenme -ppwd -pport  -d  dbname -e "sql"

資料庫 常用命令

1 登陸資料庫 mysql u root p2 高頻指令 檢視資料庫 show databases 建立資料庫 create database school schema 切換資料庫 use school schema 檢視表 檢視表項結構 3 資料庫授權 mysql grant all privi...

Oracle資料庫常用命令

export oracle sid db name 伺服器 啟動資料庫伺服器 lsnrctl start sqlplus as sysdba sql startup 資料庫 建立資料庫 oracle home bin dbca 或者 oracle home bin dbassist 連線資料庫 co...

MySQL 資料庫常用命令

1 mysql常用命令 create database name 建立資料庫 use databasename 選擇資料庫 drop database name 直接刪除資料庫,不提醒 show tables 顯示表 describe tablename 表的詳細描述 select 中加上disti...