Page 321 - IT 402 v2.0 class 10
P. 321
We can use wildcard to retrieve data:
SE L E CT F I RST NAM E , M ARK S F RO M ST U D E NT W H E RE L AST NAM E lik e ' K % ' ;
It will display firstname and marks of those students whose lastname starts with letter followed by any
number of characters from the table STUDENT.
SE L E CT M ARK S F RO M ST U D E NT W H E RE F I RST NAM E lik e ' b % ' ;
It will display marks of those students whose firstname starts with any letter and has letter b in second place
followed by any number of characters from the table STUDENT.
I S T P T T
ecords can also be added modified or deleted from the existing table using the Insert pdate and elete
commands. To type and execute SQL commands:
Click on ‘Tools’ menu and then select ‘SQL’ option. ‘Execute SQL Statement’ window appears on the screen.
Type the following SQL Commands in the ‘Command to execute’ section.
Insert Statement
‘INSERT’ statement is used to add one or more records to a database.
S nta : NSE RT I NT O T AB L E _ NAM E ( " CO L U M N1 " , " CO L U M N2 " , " CO L U M N3 " ...) V AL U E S
I
( ' V AL U E 1 ' , ' V AL U E 2 ' , ' V AL U E 3 ' ...) ;
am le : To add a record in the table ‘STUDENT’:
I NSE RT I NT O ST U D E NT ( ST U D E NT _ I D , F I RST NAM E , L AST NAM E , M ARK S)
V AL U E S ( 1 , ' Anik et' , ' K u mar ' , 9 1 ) ;
Step 1: Type the statement.
Step 2: Click on ‘Execute’ button.
1
(1) 2
Locate the image
le.
date Statement
‘Update’ statement is used for modifying records in a database.
S nta : U P D AT E T AB L E _ NAM E SE T CO L U M N_ NAM E = ' V AL U E ' W H E RE CO ND I T I O N;
am le : o update marks from to 5 of a student whose S N I is :
U P D AT E ST U D E NT SE T M ARK S = 9 5 W H E RE ST U D E NT _ I D = 1 ;
Step 1: Type the statement.
More on Database 319

