peri hokiperihokiclarustologisticsrimashaop.compola taktis menang gates of olympus x1000 perihokipemain perihoki bongkar trik jepep starlight princess x1000perihoki beri panduan lengkap bermain mahjong ways 2 pgsofttips cara penghasil uang pgsoft mahjong ways 2 perihokimahjong wins 3 perihoki memberikan penggali terbesarfenomena gates of olympus buka peluang besar bagi duta76cara dapat pola emas rahasia di duta7 wild west goldtrik menang pgsoft mahjong ways 2 modal receh maxwin duta76duta76 main pgsoft mahjong ways 2 di sela istirahatscatter hitam mahjong wins 3 spin pasti jepe duta76perihoki spin mahjong ways 2 pgsoft scatter hitam maxwinsimbol mahjong wins 3 yang sering muncul di awal perihokitrik gampang menang mahjong winscuan mahjong wins 3 tanpa hentipola spin taruhan kecil mahjong winsstrategi kunci scatter hitam beruntungacor total mahjong wayskemenangan maksimal mahjong wayskemenangan pria pekanbaru mahjong waysmahjong wins3 fenomena baru sumatera baratmenangkan mahjong dengan lincahmenembus batas keberuntungan mahjong waysmenjajal keberuntungan di mahjong wayspola gratis mahjong ways1scatter hitam senjata rahasia mahjong winsteknik spinning menguntungkan untuk scatter hitamanalisis rtp tertinggi mahjong winsfenomena scatter hitam mahjong winsibu rumah tangga dan keberuntungan mahjongkeseruan main mahjong wins3menang mahjong pengguna baru di sosial mediamenghargai setiap momen di mahjong waysserunya main mahjong di warung internetspin slow motion mancing scatterstrategi jitu maxwin mahjong waysstrategi jitu menang mahjong modal kecil jackpot besaranak kampung papua menggemparkan mahjongkeajaiban scatter hitam mahjong wayskeberhasilan joni mahjong winskejaiban mahjong ways di ujung jalanketua mahjong wins3 kehadiran kemenangan dimulai dari balimahjong kehadiran yang menguntungkanmahjong menggila adat88panduan kilat raih 108 jutatips memenangkan mahjongbarista kopi menang 110 juta spin mahjongdakota76 scatter hitam mahjong wins 3gagal cpns menang mahjong wins 3 rp120 jutakisah karyawan minimarket dapat thr lebih awal mahjong winskisah pelajar sma kuasai mahjong wins 3 inspirasi sekolahkisah penjaga parkir tanah abang motor baru mahjong winskisah sukses ibu rumah tangga bandung mahjong winsmahasiswa kkn beli iphone15 mahjong wins3 dakotamantan anak band influencer mahjong scatter hitampola rtp senin gates of olympus guru matematikaidola scatter hitam gampang meledakidola sensasi jackpotidola pola scatter hitamidola hasilkan jackpot dalam waktu singkatidola mahjong wins 3 bocortukang cuci motor menemukan keberuntungan di mahjong

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time

Filename: Session/Session.php

Line Number: 282

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_set_cookie_params(): Cannot change session cookie parameters when headers already sent

Filename: Session/Session.php

Line Number: 294

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time

Filename: Session/Session.php

Line Number: 304

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time

Filename: Session/Session.php

Line Number: 314

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time

Filename: Session/Session.php

Line Number: 315

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time

Filename: Session/Session.php

Line Number: 316

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time

Filename: Session/Session.php

Line Number: 317

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time

Filename: Session/Session.php

Line Number: 375

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time

Filename: drivers/Session_files_driver.php

Line Number: 108

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_set_save_handler(): Cannot change save handler when headers already sent

Filename: Session/Session.php

Line Number: 110

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_start(): Cannot start session when headers already sent

Filename: Session/Session.php

Line Number: 143

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

Các lệnh quản lý View trong Oracle - Freetuts
MỞ ĐẦU
ORACLE TABLE
ORACLE QUERY
ORACLE CONDITION
ORACLE CLAUSES
ORACLE OPERATORS
ORACLE JOINS
ORACLE REFERENCE
CÁC CHỦ ĐỀ
BÀI MỚI NHẤT
MỚI CẬP NHẬT

Các lệnh quản lý View trong Oracle

Bài tiếp theo này mình sẽ giới thiệu với các bạn một loại table rất đặc biệt, loại này ta sẽ gọi là view. View là một dạng table đặc biệt, là một table ảo và không hề tồn tại trong danh sách table vật lý vì nó được tạo ra khi câu lệnh được thực hiện.

test php

banquyen png
Bài viết này được đăng tại freetuts.net, không được copy dưới mọi hình thức.

Đặc điểm khá thú vị của View đó là dữ liệu của nó có thể lấy từ nhiều bảng khác nhau, bởi vì nó được tạo ra từ câu lệnh select, mà trong lệnh select thì có thẻ join nhiều bảng.

Sau đây sẽ là chi tiết về cách tạo View trong Oracle.

1. Lệnh Create View

Để tạo một view ta sử dụng cú pháp sau:

Bài viết này được đăng tại [free tuts .net]

CREATE VIEW view_name AS  
SELECT columns  
FROM tables  
WHERE conditions;  

Trong đó view_name là tên view mà bạn muốn tạo, còn các tham số khác thì bạn quá quen thuộc rồi phải không nào ;)

Giả sử ta có hai bảng như sau:

Suppliers table
CREATE TABLE  "SUPPLIERS"  
   (    "SUPPLIER_ID" NUMBER,   
    "SUPPLIER_NAME" VARCHAR2(4000),   
    "SUPPLIER_ADDRESS" VARCHAR2(4000)  
   )  

Orders table
CREATE TABLE  "ORDERS"   
   (    "ORDER_NO." NUMBER,   
    "QUANTITY" NUMBER,   
    "PRICE" NUMBER  
   )  

Bây giờ mình sẽ tạo một view với dữ liệu là tất cả đơn hàng của nhà cung cấp có tên là SAM SUNG.

CREATE VIEW sup_orders AS  
SELECT suppliers.supplier_id, orders.quantity, orders.price  
FROM suppliers  
INNER JOIN orders  
ON suppliers.supplier_id = supplier_id  
WHERE suppliers.supplier_name = 'SAM SUNG'; 

Sau khi chạy lệnh này là ta đã có một view gồm 3 column supplier_idquantity và price.

2. Lệnh Update View

Để cập nhật View thì bạn sẽ dùng lệnh CREATE OR REPLACE VIEW, lệnh này nó sẽ tạo view mới nếu chưa tồn tại, hoặc cập nhật view cũ nếu đã tồn tại.

Cú pháp
CREATE OR REPLACE VIEW view_name AS  
  SELECT columns  
  FROM table  
  WHERE conditions;

Quay lại ví dụ ở trên, mình muốn cập nhật lại view sẽ chứa danh sách order của nhà cung câp tên là NOKIA.

fádfád
CREATE or REPLACE VIEW sup_orders AS  
  SELECT suppliers.supplier_id, orders.quantity, orders.price  
  FROM suppliers  
  INNER JOIN orders  
  ON suppliers.supplier_id = supplier_id  
  WHERE suppliers.supplier_name = 'NOKIA';  

3. Xem dữ liệu trong View

Vì View cũng là một dạng table nên bạn có thể sử dụng lệnh SELECT.

SELECT * FROM sup_orders; 

4. Xóa View

Để xóa view thì ta sử dụng lệnh DROP VIEW với cú pháp như sau:

Cú pháp
DROP VIEW view_name;

Ví dụ
DROP VIEW sup_orders; 

Như vậy là mình đã giới thiệu xong một số tính năng của View trong Oracle, hy vọng bài viết này sẽ hữu ích với các bạn.

Bài này mình dừng tại đây, bài tiếp theo ta sẽ bàn về các lệnh query dùng để xử lý dữ liệu của bảng như lệnh select, delete, insert, update.

 

Cùng chuyên mục:

Hàm Hàm ASCII trong Oracle

Hàm Hàm ASCII trong Oracle

Cách sử dụng hàm Hàm ASCII trong 150

Hàm Hàm ASCIISTR trong Oracle

Hàm Hàm ASCIISTR trong Oracle

Cách sử dụng hàm Hàm ASCIISTR trong 150

Hàm Hàm CHR trong Oracle

Hàm Hàm CHR trong Oracle

Cách sử dụng hàm Hàm CHR trong 150

Hàm Hàm COMPOSE trong Oracle

Hàm Hàm COMPOSE trong Oracle

Cách sử dụng hàm Hàm COMPOSE trong 150

Hàm Hàm CONCAT trong Oracle

Hàm Hàm CONCAT trong Oracle

Cách sử dụng hàm Hàm CONCAT trong 150

Hàm Hàm CONVERT trong Oracle

Hàm Hàm CONVERT trong Oracle

Cách sử dụng hàm Hàm CONVERT trong 150

Hàm Hàm DECOMPOSE trong Oracle

Hàm Hàm DECOMPOSE trong Oracle

Cách sử dụng hàm Hàm DECOMPOSE trong 150

Hàm Hàm DUM trong Oracle

Hàm Hàm DUM trong Oracle

Cách sử dụng hàm Hàm DUM trong 150

Hàm Hàm INITCAP trong Oracle

Hàm Hàm INITCAP trong Oracle

Cách sử dụng hàm Hàm INITCAP trong 150

Hàm Hàm INSTR trong Oracle

Hàm Hàm INSTR trong Oracle

Cách sử dụng hàm Hàm INSTR trong 150

Hàm Hàm INSTR2 trong Oracle

Hàm Hàm INSTR2 trong Oracle

Cách sử dụng hàm Hàm INSTR2 trong 150

Hàm Hàm INSTR4 trong Oracle

Hàm Hàm INSTR4 trong Oracle

Cách sử dụng hàm Hàm INSTR4 trong 150

Hàm Hàm INSTRB trong Oracle

Hàm Hàm INSTRB trong Oracle

Cách sử dụng hàm Hàm INSTRB trong 150

Hàm Hàm INSTRC trong Oracle

Hàm Hàm INSTRC trong Oracle

Cách sử dụng hàm Hàm INSTRC trong 150

Hàm Hàm LENGTH trong Oracle

Hàm Hàm LENGTH trong Oracle

Cách sử dụng hàm Hàm LENGTH trong 150

Hàm Hàm LENGTH2 trong Oracle

Hàm Hàm LENGTH2 trong Oracle

Cách sử dụng hàm Hàm LENGTH2 trong 150

Hàm Hàm LOWER trong Oracle

Hàm Hàm LOWER trong Oracle

Cách sử dụng hàm Hàm LOWER trong 150

Hàm Hàm LPAD trong Oracle

Hàm Hàm LPAD trong Oracle

Cách sử dụng hàm Hàm LPAD trong 150

Hàm Hàm LTRIM trong Oracle

Hàm Hàm LTRIM trong Oracle

Cách sử dụng hàm Hàm LTRIM trong 150

Hàm Hàm NCHR trong Oracle

Hàm Hàm NCHR trong Oracle

Cách sử dụng hàm Hàm NCHR trong 150

Top