學習簡單資料庫表操作(Mysql)2

2023-01-24 12:26:06 字數 1477 閱讀 8869

以orcl例項下,person表為例:

1.登入mysql:

mysql安裝路徑下,bin目錄,開啟命令視窗,輸入mysql -u使用者名稱 -p密碼;

2.顯示所有例項,show databases;

3.進入orcl例項,use orcl;

4.顯示person表欄位資訊,desc person;

5.修改欄位描述,alter table person change pid pid int(11) not null;

6.修改表名,alter table person rename to people;

7.查,select *from person;

8.增,insert into person(name,age,birthday,salary) values('ming',11,'1999-01-01',1000);

9.改,update person set name = 'xiaoli' where pid = 11;

10.刪,delete from person where pid = 10;

11.數,select count(1), age from person group by age;

12.排序,select name,salary from person order by salary asc;

select name,salary from person order by salary desc;

mysql簡單資料庫分表操作

最近公司的某一表單因為資料量有點小大,經常因為那個啥全表查詢操作產生記憶體溢位,簡單來說,就是資料庫經常罷工,然後嘞就打算分一下表。具體的那些高大上的理論知識咱是說不來。就簡單為大家介紹一下本人所做的分表的一個思路哈。首先嘞,考慮一下現實因素,我們公司這邊呢,資料庫是跟不上如此大的查詢操作,就算是查...

mysql資料庫簡單操作

1 顯示所有資料庫 show databases 2 檢視所有使用者 select host,user,password from mysql.user 3 建立資料庫 create database sybdb 4 使用資料庫 use sybdb 5 顯示資料庫中的表 show tables 6 ...

MySQL學習02 資料表操作

資料表示資料庫最重要的組成部分之一,是其他物件的基礎。1.開啟資料庫 use 資料庫名稱 2.檢查資料庫是否開啟 select database 3.建立資料表 create table if notexists table name column name data type,4.檢視資料表列表 ...