1 / 7

STRUKTUR TABEL

STRUKTUR TABEL. CREATE TABLE MAHASISWA ( NIM char (10) PRIMARY KEY , NAMA varchar (100) , TEMPATLAHIR varchar (50) , TGLLAHIR datetime , JENKEL char (1) , ALAMATASAL varchar (100) , ALAMATKOST varchar (100) , TELF varchar (15) , JURUSAN char (10) ,

tate-dyer
Download Presentation

STRUKTUR TABEL

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. STRUKTUR TABEL

  2. CREATE TABLE MAHASISWA ( NIM char (10) PRIMARY KEY , NAMA varchar (100) , TEMPATLAHIR varchar (50) , TGLLAHIR datetime , JENKEL char (1) , ALAMATASAL varchar (100) , ALAMATKOST varchar (100) , TELF varchar (15) , JURUSAN char (10) , NAMAORTU varchar (50) , TELFORTU varchar (15) )

  3. Sintak-sintak SQL-DDLlebih lengkap  menu “HELP” Sample sintak dibawah ini diserver DBMYSQL • Membuat database Create Database [database name] • Mengaktifkan database yg akan pakai Use [database name] • Membuat tabel Create Table [table name]… • Menampilkan tabel Show tables select table_name from information_schema.tables where table_type='base table‘  di server MS.SQL Server

  4. CREATE TABLE KURIKULUM ( KODEMK varchar (10) primary key, NAMAMK varchar (100), JURUSAN char (2) , SKS smallint , SKSP smallint , SEMESTER smallint)

  5. CREATE TABLE KRS ( IDKRS int primary key, KODEMK varchar (10) foreign key references kurikulum (kodemk), NIM char (10) foreign key references mahasiswa (nim), SEMESTER smallint, THN_AKADEMIK char (9) , NILAI char (1) )

  6. Sintak SQL  Entri data • Insert into [table name ] (field1, field2….field) values (n1,n1,……..) • Isikan data ke masing-masing tabel. • Jangan lupa entrikan data pada tabel yang direferensikan oleh tabel lain terlebih dahulu. Why ?

  7. Execise • Coba rubahlah struktur table yang telah anda buat, misal type data dirubah, bagaimana sintaknya ? • Bagaimana caranya jika Anda lupa mendefinisikan primary key dan Foreign key pada tabel ? • Hapuslah tabel yang telah Anda buat, bagaimana sintaknya ? Menjawab pertanyaan diatas, tentunya ada beberapa “message error”, sebutkan apa saja ? Kenapa demikian ? dan cari solusinya ? ** Catat (diprint screen, pelajari dan dikumpulkan minggu depan..

More Related