資料庫操作
1.創建Student資料庫
創建以下資料表(表格中內容不要有中文)
1.1登錄資訊表
| 用戶名(職工號/學號) ID | 密碼 Pwd | 職位(教師/學生)Job | 聯系方式Tel |
|---|---|---|---|
| 1001 | 默認密碼:123456 | teacher | 111111 |
| 1002 | 123456 | teacher | 222222 |
| 10003 | 123456 | student | 333333 |
| 10004 | 123456 | student | 444444 |
| 10005 | 123456 | studnet | 555555 |
1.2 學生資訊表
| 學號ID | 姓名Name | 性別Sex | 年齡Age | 入學日期StudyDate | 專業Major | 班級Class | 家庭地址Address | 聯系方式Tel |
|---|---|---|---|---|---|---|---|---|
| 10003 | bob | boy | 19 | 2019 | AI | 1902 | yantai | 333333 |
| 10004 | pop | girl | 20 | 2020 | NET | 2001 | weifang | 444444 |
| 10005 | smith | girl | 21 | 2021 | DL | 2101 | jinan | 555555 |
1.3 學生成績表
| 學號ID | 姓名Name | 專業Major | 班級Class | 數學Math | Java | MySQL |
|---|---|---|---|---|---|---|
| 10003 | bob | AI | 1902 | 66 | 77 | 88 |
| 10004 | pop | NET | 2001 | 77 | 88 | 99 |
| 10005 | smith | DL | 2101 | 88 | 77 | 66 |
1.4資料庫表格操作
創建Student資料庫
Create database StudentDB;
使用資料庫
Use StudentDB;
創建登錄資訊表Login_info
Create table Login_info(ID varchar(10) primary key,
Pwd varchar(10) default 123456,
Job varchar(10) not null,
Tel varchar(11) not null);

插入資料
Insert into Login_info(ID,Job,Tel)
values(“1001”,”teacher”,”111111”),(“1002”,”teacher”,”222222”),(“10003”,”student”,”333333”),(“10004”,”student”,”444444”),(“10005”,”student”,”555555”);

創建學生資訊表Student_info
Create table Student_info(ID varchar(10) primary key,
Name varchar(10) not null,
Sex varchar(10) not null,
Age int not null,
StudyDate Date not null,
Major varchar(10) not null,
Class int not null,
Address varchar(15),
Tel varchar(11) not null);

插入資料
Insert into Student_info Values(”10003”,”bob”,”boy”,19,20190901,”AI”,1902,”yantai”,”333333”),(“10004”,”pop”,”girl”,20,”20200901”,”NET”,2001,”weifang”,”444444”),(“10005”,”smith”,”girl”,21,”20210901”,”DL”,2101,”jinan”,”555555”);

創建學生成績表Student_score
Create table Student_score(ID varchar(10) primary key,
Name varchar(10) not null,
Major varchar(10) not null,
Class int not null,
Math varchar(10) not null,
Java varchar(10) not null,
MySQL varchar(10) not null);

插入資料
Insert into Student_score
Values(“10003”,”bob”,”AI”,1902,”66”,”77”,”88”),(“10004”,”pop”,”NET”,2001,”77”,”88”,”99”),(“10005”,”smith”,”DL”,2101,”88”,”77”,”66”);

根據表格內容自行對資料庫中表格內容進行插入;
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/350898.html
標籤:java
下一篇:集合(Java)
