SlideShare a Scribd company logo
1 of 2
Bài thực hành số 1
1. Tạo một user với tên là: Tên máy + Tên Sinh viên. VD: may01Nga
2. Grant quyền connect cho user trên
3. Grant quyền create table cho user trên
4. Grant quyền tạo view cho user tren
5. Grant quyền tạo sequence
6. Thay đổi mật khẩu của user trên
7. Lock user trên. Đăng nhập vào user này để kiểm tra user đã bị lock hay chưa
8. Unlock user trên
9. Đăng nhập vào user trên
10. Tạo các bảng có cấu trúc
10.1 Bảng TB_LOP
STT Tên trường Kiểu dữ liệu Độ dài Điều kiện
1 ID Number NOT NULL
2 TENLOP Varchar2 100
3 ID_GVIEN_CN Number
10.2 Bảng TB_SINHVIEN
STT Tên trường Kiểu dữ liệu Độ dài Điều kiện
1 ID Number NOT NULL
2 ID_LOP Number
3 TENSINHVIEN Varchar2 200
4 NGAYSINH Date
5 NOISINH Varchar2 500
6 DIEMTHI Float
10.3 Bảng TB_GVIEN_CN
STT Tên trường Kiểu dữ liệu Độ dài Điều kiện
1 ID Number NOT NULL
2 TENGVIEN Varchar2 200
11. Tạo khóa chính trên trường ID cho mỗi bảng trên. Qui tắc đặt tên PK_[Tên bảng]. VD:
PK_ TB_LOP
12. Tạo khóa ngoại cho bảng TB_LOP trên trường ID_GVIEN_CN tham chiếu đến trường
ID của bảng TB_GVIEN_CN. Qui tắc đặt tên FK_[Tên bảng].
13. Tạo ba sequence cho ba bảng trên. Mỗi sequence bắt đầu là 1, mỗi lần tăng 1, giá trị
nhỏ nhất là 1. Qui tắc đặt tên: SEQ_[Tên bảng]
14. Insert dữ liệu vào bảng TB_GVIEN_CN với các giáo viên sau:
Nguyen Van An
Bui Ngoc Nam
Le Bich Hong
Pham Van Quan
Lưu ý: Cột ID sẽ lấy dữ liệu từ seq tương ứng
15. Insert dữ liệu vào bảng TB_LOP với tên lớp như sau:
1
CTO706L
CTO707L
CTO708L
CTO709L
Lưu ý: Cột ID sẽ lấy dữ liêu từ seq tương ứng. Cột ID_GVIEN_CN sẽ lấy dữ liệu sao
cho Nguyen Van An là giáo viên chủ nhiệm của lớp CTO706L, Bui Ngoc Nam là giáo
viên chủ nhiệm của lớp CTO707L, Bui Ngoc Nam là giáo viên chủ nhiệm của lớp
CTO708L, Pham Van Quan là giáo viên chủ nhiệm của lớp CTO709L.
16. Insert dữ liệu vào bảng TB_SINHVIEN với dữ liệu như sau:
TENSINHVIEN NGAYSINH NOISINH DIEMTHI
Le Hong Anh 11/03/1988 Thai Nguyen 7.5
Nguyen Manh Hai 03/04/1988 Phu Tho 9
Dao Duy Anh 25/01/1989 Nghe An 5
Vuong Viet An 06/08/1987 Tuyen Quang 4
Hoang Hai 17/09/1988 Ha noi
Le Uyen 22/06/1988 Bac Ninh
Lưu ý: Cốt ID sẽ lấy dữ liệu từ seq tương ứng. Cột ID_LOP sẽ lấy dữ liệu sao cho tất cả
sinh viên trong bảng đều thuộc lớp CTO707L.
17. In ra danh sách sinh viên có điểm thi đạt, không đạt, chưa thi (>=5 đạt)
18. In ra danh sách giáo viên không chủ nhiệm lớp nào
19. Tạo một view tên là v_sinhvien có chứa các trường TENSINHVIEN, TENLOP,
TENGVIEN_CN
20. Đăng nhập vào user hr
21. Tạo role tên là role_emp
22. Grant quyền select,insert,update trên bảng employees cho role role_emp
23. Grant role role_emp cho user tạo ở trên
24. Đăng nhập vào user tạo ở trên, hiển thị dữ liệu của bảng EMPLOYEES của user hr
25. Tạo bảng EMPLOYEES2 có cấu trúc dữ liệu hoàn toàn giống cấu trúc dữ liệu của bảng
EMPLOYEES trong hr;
2

More Related Content

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

Thuchanh1

  • 1. Bài thực hành số 1 1. Tạo một user với tên là: Tên máy + Tên Sinh viên. VD: may01Nga 2. Grant quyền connect cho user trên 3. Grant quyền create table cho user trên 4. Grant quyền tạo view cho user tren 5. Grant quyền tạo sequence 6. Thay đổi mật khẩu của user trên 7. Lock user trên. Đăng nhập vào user này để kiểm tra user đã bị lock hay chưa 8. Unlock user trên 9. Đăng nhập vào user trên 10. Tạo các bảng có cấu trúc 10.1 Bảng TB_LOP STT Tên trường Kiểu dữ liệu Độ dài Điều kiện 1 ID Number NOT NULL 2 TENLOP Varchar2 100 3 ID_GVIEN_CN Number 10.2 Bảng TB_SINHVIEN STT Tên trường Kiểu dữ liệu Độ dài Điều kiện 1 ID Number NOT NULL 2 ID_LOP Number 3 TENSINHVIEN Varchar2 200 4 NGAYSINH Date 5 NOISINH Varchar2 500 6 DIEMTHI Float 10.3 Bảng TB_GVIEN_CN STT Tên trường Kiểu dữ liệu Độ dài Điều kiện 1 ID Number NOT NULL 2 TENGVIEN Varchar2 200 11. Tạo khóa chính trên trường ID cho mỗi bảng trên. Qui tắc đặt tên PK_[Tên bảng]. VD: PK_ TB_LOP 12. Tạo khóa ngoại cho bảng TB_LOP trên trường ID_GVIEN_CN tham chiếu đến trường ID của bảng TB_GVIEN_CN. Qui tắc đặt tên FK_[Tên bảng]. 13. Tạo ba sequence cho ba bảng trên. Mỗi sequence bắt đầu là 1, mỗi lần tăng 1, giá trị nhỏ nhất là 1. Qui tắc đặt tên: SEQ_[Tên bảng] 14. Insert dữ liệu vào bảng TB_GVIEN_CN với các giáo viên sau: Nguyen Van An Bui Ngoc Nam Le Bich Hong Pham Van Quan Lưu ý: Cột ID sẽ lấy dữ liệu từ seq tương ứng 15. Insert dữ liệu vào bảng TB_LOP với tên lớp như sau: 1
  • 2. CTO706L CTO707L CTO708L CTO709L Lưu ý: Cột ID sẽ lấy dữ liêu từ seq tương ứng. Cột ID_GVIEN_CN sẽ lấy dữ liệu sao cho Nguyen Van An là giáo viên chủ nhiệm của lớp CTO706L, Bui Ngoc Nam là giáo viên chủ nhiệm của lớp CTO707L, Bui Ngoc Nam là giáo viên chủ nhiệm của lớp CTO708L, Pham Van Quan là giáo viên chủ nhiệm của lớp CTO709L. 16. Insert dữ liệu vào bảng TB_SINHVIEN với dữ liệu như sau: TENSINHVIEN NGAYSINH NOISINH DIEMTHI Le Hong Anh 11/03/1988 Thai Nguyen 7.5 Nguyen Manh Hai 03/04/1988 Phu Tho 9 Dao Duy Anh 25/01/1989 Nghe An 5 Vuong Viet An 06/08/1987 Tuyen Quang 4 Hoang Hai 17/09/1988 Ha noi Le Uyen 22/06/1988 Bac Ninh Lưu ý: Cốt ID sẽ lấy dữ liệu từ seq tương ứng. Cột ID_LOP sẽ lấy dữ liệu sao cho tất cả sinh viên trong bảng đều thuộc lớp CTO707L. 17. In ra danh sách sinh viên có điểm thi đạt, không đạt, chưa thi (>=5 đạt) 18. In ra danh sách giáo viên không chủ nhiệm lớp nào 19. Tạo một view tên là v_sinhvien có chứa các trường TENSINHVIEN, TENLOP, TENGVIEN_CN 20. Đăng nhập vào user hr 21. Tạo role tên là role_emp 22. Grant quyền select,insert,update trên bảng employees cho role role_emp 23. Grant role role_emp cho user tạo ở trên 24. Đăng nhập vào user tạo ở trên, hiển thị dữ liệu của bảng EMPLOYEES của user hr 25. Tạo bảng EMPLOYEES2 có cấu trúc dữ liệu hoàn toàn giống cấu trúc dữ liệu của bảng EMPLOYEES trong hr; 2