Sunday, 3 July 2011

Inserting a row with selected columns

It is possible to insert a new row by giving values only for a few columns instead of giving values for all the available columns.

The following INSERT command will insert a new row only two values.

insert into courses(ccode,name)
values ('odba','Oracle Database Administration');

The above command will create a new row in COURSES table with values for only two columns – CCODE and NAME. The remaining columns will take NULL value or the default value, if the column is associated with default value. We will discuss more about default value in the next chapter.

NULL value
Null value means a value that is not available or not known. When a column’s value is not known then we store NULL value into the column. NULL value is neither 0 nor blank nor any other known value. We have already seen how to store null value into a column and when Oracle automatically stores null value into a column. We will discuss more about how to process null value later in this chapter.

SQL Interview Questions and Answers

There is given sql interview questions and answers that has been asked in many companies. For PL/SQL interview questions, visit our next...