1 / 2

Mampu membuat Tabel di server database (part II)

Mampu membuat Tabel di server database (part II). Mendefinisikan nilai null 1. Apa itu “null” ? “null” tidak dihitung/tidak mempunyai nilai 2. Perbedaan antara nilai “0” dgn “null” “null”  tidak mempunyai nilai sedangkan “0”  mempunyai nilai Contoh buat tabel :

sidone
Download Presentation

Mampu membuat Tabel di server database (part II)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Mampu membuat Tabel di server database (part II) Mendefinisikan nilai null 1. Apa itu “null” ? “null” tidak dihitung/tidak mempunyai nilai 2. Perbedaan antara nilai “0” dgn “null” “null” tidak mempunyai nilai sedangkan “0”  mempunyai nilai Contoh buat tabel : CREATE TABLE datacontoh ( id INT identity,data_A float,data_b float ) Isikan data-datanya ke tabel tersebut : INSERT INTO datacontoh VALUES ( 2, 6) INSERT INTO datacontoh VALUES ( 4, NULL) INSERT INTO datacontoh VALUES ( 5, 0) INSERT INTO datacontoh VALUES ( NULL, 7) Lihat isi datanya dan amati hasilnya : select * from datacontoh1 SELECT id, ( data_a + data_b ) AS jumData FROM datacontoh1 GROUP BY id,data_a,data_b

  2. Mendefinisikan Autonumber • Autonumber  penomoran otomatis Biasa dipakai pada kolom/field yang mengandung Primary Key • Sintak : Fieldname identity (start,increament) • Contoh : CREATE TABLE datacontoh2 ( id int IDENTITY (1, 1) NOT NULL , data_A float NULL , data_b float NULL) ON PRIMARY • Cobalah anda buat tabel dengan cara mengganti start dan increament dari indentity,isikan beberapa buah data, dan lihatlah hasilnya.

More Related