To specify the default value in a SQL statement, when creating the
column, before the semi-colon or the closing parenthesis of the last column,
assign the desired value to the DEFAULT keyword.
CREATE TABLE student
(
Student_name VARCHAR(50),
Address VARCHAR(80),
City VARCHAR(50) DEFAULT 'tadipatri',
Postal_Code VARCHAR(50) DEFAULT '515411',
)
insert into student(Student_name,Address)values('adi','thathagaripalli')
insert into student(Student_name,Address)values('raja','thathagaripalli')
insert into student(Student_name,Address,City,Postal_Code)values('ravi','juturu','anantapur','515111')
insert into student(Student_name,Address,City,Postal_Code)values('balu','anantapur','anantapur','515111')
select * from student
OUTPUT
No comments:
Post a Comment