SLIS A-Z Index
People Search
SLIS Calendar

Programs

Courses

Textbooks by Semester

Course Web Pages - Spring 2012 - LIBR 242-01/10 Greensheet - Sample Codes - SQL INSERT

Entering/Modifying/Deleting Data Records in Table


1. To enter (append) a record into a table


INSERT INTO CUSTOMER VALUES 
	(`101', `Newton', `John', `G', `11-AUG-92', 
	`1250 First St., San Jose, CA95192', `14089242457', 1000.00);

2. To enter data only into specified fields of a record (e.g, a partial record),


INSERT INTO INVOICE (INV_NUM, CUS_CODE, ISSUE_DATE, DUE_DATE)
	VALUES (132453, `101', `30-DEC-00', `30-DEC-02');

3. To delete all records from a table


DELETE FROM PRODUCT;

4. To delete from a table only some records that meet certain condition,


DELETE FROM PRODUCT
	WHERE PROD_CODE = `4567984';

5. To update (reset) values in a column across the whole table,


UPDATE CUSTOMER SET BALANCE=0;

6. To update (reset) values in a column only in some records that meet certain condition,


UPDATE CUSTOMER SET BALANCE=0
	WHERE CUS_LNAME='Liu';


Select here to return to the sample codes page.