what is the meaning of null valu in sql

Posted by Mohit007kumar00 under Sql Server on 5/27/2010 | Views : 1855 | Status : [Member] | Replies : 5
hi friend's
i write a query like this
 1  create table boy1(name char(20),branch char(20) not null,regdno number(20),
2* unique(name,branch))

so what is the diff bet variable name and branch.
i unable to understand what the null means.
in the above query what can i do with name variable that we dont do with branch.

mohit cboy hack the world


Responses

Posted by: BangaruBabu on: 5/27/2010 [Member] Starter

Up
0
Down
What if you have a row that doesn't have any data for a particular column-that is, what if you simply
don't know the value? For example, let's say that we have a record that is trying to store the company
performance information for a given year. Now, imagine that one of the fields is a percentage growth

over the prior year, but you don't have records for the year before the first record in your database. You
might be tempted to just enter a zero in the Percent Growth column. Would that provide the right information
though? People who didn't know better might think that meant you had zero percent growth,
when the fact is that you simply don't know the value for that year.
Values that are indeterminate are said to be NULL. . Well, that's a tough one, because, by definition, a
NULL value means that you don't know what the value is. It could be 1; it could be 347; it could be -294 for
all we know. In short, it means undefined or perhaps not applicable.

BangaruBabu Pureti
http://bangarubabupureti.spaces.live.com/

Mohit007kumar00, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mohit007kumar00 on: 5/27/2010 [Member] Starter

Up
0
Down
thanks BangaruBabu,
but how can be define a null valu.
i want to insert a null valu in rollno columan of student table can you give the query please.

one more question i want to know in oracle 9i not null is bydefault or not because when i doesn't insert any valu in any columan it will give an error.

mohit cboy hack the world

Mohit007kumar00, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: BangaruBabu on: 5/27/2010 [Member] Starter

Up
0
Down
Hi Check This Query

INSERT INTO STUDENTTABLENAME(ROLLNO, NAME, CLASS)VALUES(NULL, 'BANGARUBABU','10TH CLASS' );


BangaruBabu Pureti
http://bangarubabupureti.spaces.live.com/

Mohit007kumar00, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Er.deepakdalal on: 5/27/2010 [Member] Starter

Up
0
Down
Try this link its really a nice article on the Null value in the database.


http://www.databasedev.co.uk/null_values_defined.html

Mohit007kumar00, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Neeks on: 7/21/2010 [Member] Bronze

Up
0
Down
You cannot keep the branch as blank or as NULL. but you can keep the name as blank as it allows null value. But you cannot have more than One NULL in the table as name is defined as Unique.
You can add duplicate branch as it has not been declared as unique but it cannot be NULL

Thanks,

Mohit007kumar00, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response