mysql 銀行登入 MySQL 基礎命令一

2021-10-20 22:37:16 字數 1331 閱讀 1330

建立資料庫

命令:create database

例如,建立乙個名為 test 的資料庫

mysql> create database test;

刪除資料庫

命令: drop database

例如,刪除名為 test 的資料庫

mysql> drop database test

連線資料庫

命令: use

例如,如果test資料庫存在,嘗試訪問它:

mysql> use test

database changed

建表命令:create table ( [,.. ]);

例如,建立乙個名為table_1的表,此表記錄班上的人員及平均成績,那麼用字段 id 代表編號,為數字型別,且編號唯一,不能為空, 預設值為 0 ; 用字段 name 代表人名,為字元型,不為空;用字段 degree 代表成績,為數字型,可為空。編號id 為此表的關鍵字。

建表如下:

mysql> create tabletable_1 (> id int(4) default '0' not null,> name char(20) not null

> degree double(16,2) ,> primary key(id));

刪除表命令:drop table

例如,刪除表名為 table_1 的表

mysql> drop table table_1;

插入資料

命令:insert into [( [,.. ])]

values ( 值1 )[, ( 值n )]

例如,往表 test 中插入二條記錄, 這二條記錄表示:

編號為1的名為joan 的成績為96.45, 編號為2 的名為jeanny 的成績為82.99.

命令如下:

mysql> insert into test values(1,'joan',96.45),(2,'jeanny',82.99);

查詢表中的資料

命令: select from < 表名 > where < 表示式 >

例如,檢視表 test 中所有資料

mysql> select * from test;

螢幕顯示:

| id | name | degree |

| 1 | joan | 96.45 |

| 2 | jeanny | 82.99 |

刪除表中資料

命令: delete from < 表名 > where < 表示式 >

例如,刪除表 test 中編號為1 的記錄

mysql> delete from test where id=1;

mysql怎麼登入 mysql怎麼登入

當 mysql 服務開啟後,就可以通過客戶端來登入 mysql 資料庫了。在 windows 作業系統下可以使用 dos 命令登入資料庫,本節將 介紹使用命令方式登入 mysql 資料庫的方法。登入 mysql 資料庫的具體操作步驟如下 步驟 1 單擊 開始 windows 系統 命令提示符 如圖所...

mysql登入密碼 mysql修改登入密碼三種方式

一.用set password命令 首先登入mysql,使用mysql自帶的那個客戶端連線上mysql。格式 mysql set password for 使用者名稱 localhost password 新密碼 例子 mysql set password for root localhost pa...

中信銀行MySQL面試

面試官的問題 問springmvc的流程。答請求 dispatcherservlet handler controller dispatcherservlet modelandview view。問執行緒池的幾個引數有哪些,都是做什麼的。答當乙個任務通過execute runnable 方法欲新增到...