Beranda > Basis Data > Alias SQL Database

Alias SQL Database

Dengan SQL, alias dapat digunakan untuk memberi nama kolom dan tabel

Nama Alias Kolom

Syntax:

SELECT column AS column_alias FROM table

Nama Alias Tabel

Syntax:

SELECT column FROM table AS table_alias

Contoh: Menggunakan Alias Kolom

Tabel Persons:

LastName FirstName Address City
Hansen Ola Timoteivn 10 Sandnes
Svendson Tove Borgvn 23 Sandnes
Pettersen Kari Storgt 20 Stavanger

SQL:

SELECT LastName AS Family, FirstName AS Name

FROM Persons

Hasil:

Family Name
Hansen Ola
Svendson Tove
Pettersen Kari

Contoh : Menggunakan sebuah Tabel Alias

Tabel Persons:

LastName FirstName Address City
Hansen Ola Timoteivn 10 Sandnes
Svendson Tove Borgvn 23 Sandnes
Pettersen Kari Storgt 20 Stavanger

SQL:

SELECT LastName, FirstName

FROM Persons AS Employees

Hasil:

Tabel Employees:

LastName FirstName
Hansen Ola
Svendson Tove
Pettersen Kari

 

Iklan
  1. Belum ada komentar.
  1. No trackbacks yet.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: