Bài thực hành Oracle (4 tuần) - Tunghuynh_bai3

545 0 0
                                    

-- ------------------- STUDENT: Tùng Huynh

-- ------------------- CLASS:    K7A

-- ------------------- Lesson 3.

-- Cau I: (Session -> New Session: SYSTEM)

-- Tạo user và grant quyền

create user may12tunghuynh IDENTIFIED by 12345;

grant CONNECT to may12tunghuynh;

grant RESOURCE to may12tunghuynh;

grant create view to may12tunghuynh;

-- Câu II: Đăng nhập vào user hr (Session -> New Session: HR)

-- II.1.

-- Hiển thị mô tả các bảng (Tên các trường, kiểu dữ liệu,...)

-- COUNTRIES, DEPARTMENTS, EMPLOYEES, JOB_HISTORY, JOBS, LOCATIONS, REGIONS của hr.

describe hr.employees;

describe hr.countries;

describe hr.departments;

describe hr.job_history;

describe hr.jobs;

describe hr.locations;

describe hr.regions;

-- II.2.   

-- Grant quyền select trên các bảng COUNTRIES, DEPARTMENTS, EMPLOYEES,

-- JOB_HISTORY, JOBS, LOCATIONS, REGIONS của hr cho user đã tạo ở câu I

grant select on countries to may12tunghuynh;

grant select on departments to may12tunghuynh;

grant select on employees to may12tunghuynh;

grant select on job_history to may12tunghuynh;

grant select on jobs to may12tunghuynh;

grant SELECT on locations to may12tunghuynh;

grant SELECT on regions to may12tunghuynh;

-- Cau III: Đăng nhập vào user đã tạo ở câu I (Session -> New Session: MAY12TUNGHUYNH)

SELECT * from hr.jobs

-- III.1.   

-- Hiển thị đầy đủ các trường của các bảng COUNTRIES, DEPARTMENTS,

-- EMPLOYEES, JOB_HISTORY, JOBS, LOCATIONS, REGIONS trong user hr.

-- III.2.   

-- Hiển thị cột FIRST_NAME ghép với cột LAST_NAME cách nhau

-- bằng một khoảng trống và đặt tên cột ghép này là FULL NAME.

select hr.employees.first_name ||' ' || hr.employees.last_name as "Full name"

from hr.employees

-- III.3.   

-- Hiển thị tên đầy đủ của nhân viên, email, số điện thoại,

-- tên công việc, ngày vào làm. Dữ liệu lấy về phải sắp xếp theo ngày vào làm giảm dần.

Hai finito le parti pubblicate.

⏰ Ultimo aggiornamento: Apr 08, 2011 ⏰

Aggiungi questa storia alla tua Biblioteca per ricevere una notifica quando verrà pubblicata la prossima parte!

Bài thực hành Oracle (4 tuần) - Tunghuynh_bai1Dove le storie prendono vita. Scoprilo ora