SELECT * from students;
SELECT
*
FROM
students
;
select *
from students;
SQL> create table pelajar (IC_ITM number(8,0), NAMA char(35)); Table created.
SQL> create table pelajar as
select * from STUDENTS; Table created.
SQL> create table pelajar as
select STUD_ID, NAME, SEX from STUDENTS; Table created.
SQL> desc STUDENTS; Name Null? Type ------------------------------- -------- ---- IC_ITM NOT NULL NUMBER(8) NAME NOT NULL VARCHAR2(35) ADD_1 VARCHAR2(30) ADD_2 VARCHAR2(30) STATE VARCHAR2(20) POSTCODE NUMBER(5) PHONE_NO NUMBER(9) CITY VARCHAR2(20)
SQL> insert into pelajar values(93648307,'muhammad fauzi');
SQL> insert into pelajar (IC_ITM) values (93648307);
SQL> select table_name from tabs;
TABLE_NAME ------------------------------ REGISTRATIONS SEMESTER_RECORDS STUDENTS SUBJECTS 4 rows selected.
SQL> select * from subjects;
SUBJ_C CREDIT_HOUR S_DESC ------ ----------- ----------------------------- CSC101 2 PENGENALAN KPD SAINS KOMPUTER CSC113 4 ASAS PEMBINAAN ALGORITMA MAT120 4 MATEMATIK I UIS101 2 ISLAM SEBAGAI AD-DEEN ENL110 3 FOUNDATION ENGLISH I KKR101 1 KO-KURIKULUM I CSC152 4 TEKNOLOGI KOMPUTER CSC165 4 PENGATURCARAAN BERSTRUKTUR MAT170 4 MATEMATIK II QMT100 4 PENGENALAN KEPADA STATISTIK UIS151 2 KONSEP IBADAH 11 rows selected.
SQL> select ic_itm, name from students;
IC_ITM NAME ---------- ----------------------------------- 92159234 ADRIANTI MONAK AK RAPHAEL 92665421 ADRIZAL BIN JAAFAR 92591406 AHMAD FAUZI B SUDIM @ HJ BASRI 92706457 AHMAD RAZAKI BIN ALI @ A RAHMAN 92656729 ALFIZA BT ABDUL JAMAL 92575015 AMIZA BIN MOHAMMAD 92651853 AMRI AKMAR BIN MOHD KASIM 92102666 ANDY FRANCIS @ ANDY BIN ANGGI 92566383 ANISAH BT JOHARI 92568976 ANITA BT ARIFIN 91702205 ANUAR BIN ABDUL LATEH 11 rows selected.
SQL> select ic_itm, name, ic_itm + 1 from students;
IC_ITM NAME IC_ITM+1 ---------- ----------------------------------- ---------- 93648307 NUR MAZLINA FAUZY 93648308 90707085 MUHAMMAD FAUZI SAMSURI 90707086 2 rows selected.
SQL> alter table pelajar modify name varchar(40);
Table altered.
SQL> alter table pelajar modify name varchar(35);Column tersebut perlu dikosongkan sebelum panjangnya boleh dikurangkan. Sila gunakan arahan delete.
ERROR at line 1:
ORA-01441: column to be modified must be empty to decrease column length
SQL> alter table pelajar add course varchar(4);
SQL> alter table pelajar modify ic_itm char(8); table altered.
SQL> update pelajar set name='Nur Mazlina Fauzy'
SQL> delete from pelajar; 2 rows deleted.
SQL> delete from pelajar where ic_itm = 93648307; 1 rows deleted.
SQL> drop table students;
Table dropped.
![]() |
Copyright © 1995-1999 Fz Sdc nsr@melayu.com http://www.melayu.com/nsr |