What is the main different between Null and NOT Null.
Difference between Primary and Unique Key.
How to Check the database from which application is it
possibe.
Answers were Sorted based on User's Feedback
Answer / kalpana
Primary key can never be NULL.it is used to uniquely
identify the row in a table.The database engine requeir a
value to relocate the record.so Primary key can never be
NUL.unique key may be NULL.
Is This Answer Correct ? | 21 Yes | 0 No |
Answer / sunil kumar
Hello Nivedita,
I am not satisfied with ur answer the difference between
primary key and foreign key.I think the answer is reverse.
Is This Answer Correct ? | 15 Yes | 1 No |
Answer / bharanikumar
primary key does not allow null value,
but unique allow only one null value...
www.happylife.in
Is This Answer Correct ? | 6 Yes | 0 No |
Answer / amit kumar tiwari
primary key uniquely define each table and never allow NULL
value. But unique key may be NULL value.
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / g priya
If a field is null the database engine makes the field to be 0
if not null is specified ,field must be given a value
Primary key is unique,not null,index where as Unique key has
1 null value
Is This Answer Correct ? | 2 Yes | 5 No |
Answer / nivedita
IF NULL is specified,the feild is allow to be left empty
without any value.
IF NOT NULL is specified,the field must be given a value. In
the absence of either a NULL or NOT NULL, NULL is assumed.
-------
Unique key can't be NULL.Primary key can be NULL.
Unique key always contain unique value,duplicate are not
allowed(genrally the system genrated key).Primary key maybe
repeated.
Is This Answer Correct ? | 6 Yes | 35 No |
How show all tables in mysql query?
How to use case expression?
about join
How do I run a query in mysql?
Can you shard mysql?
How to find the unique values if the value in the column is repeated?
What is DML in MySQL?
What is mysql sleep process?
mysql> select * from store; +------+-------+-------+ | id | month | sales | +------+-------+-------+ | 1 | 1 | 100 | | 1 | 2 | 100 | | 1 | 3 | 200 | | 1 | 4 | 300 | | 1 | 5 | NULL | | 1 | 6 | 200 | | 1 | 7 | 800 | | 1 | 8 | 100 | | 1 | 9 | 240 | | 1 | 10 | 140 | | 1 | 11 | 400 | | 1 | 12 | 300 | | 2 | 1 | 300 | | 2 | 2 | 300 | | 2 | 3 | 300 | | 2 | 4 | 200 | | 2 | 5 | 200 | | 2 | 6 | 200 | | 2 | 7 | 100 | | 2 | 8 | 100 | | 2 | 9 | 300 | | 2 | 10 | 100 | | 2 | 11 | 150 | | 2 | 12 | 150 | +------+-------+-------+ this is my table. i need to display output like this. +------+----------+----------+----------+----------+ | id | quarter1 | quarter2 | quarter3 | quarter4 | +------+----------+----------+----------+----------+ | 1 | 400 | 500 | 1140 | 840 | | 2 | 900 | 600 | 500 | 400 | +------+----------+----------+----------+----------+ what single query i have to write for this. i tried this query and it displays like the below mysql> select id,sum(sales) as quarter1,(select sum(sales) from store where mont h>3 and month<7 ) as quarter2,(select sum(sales) from store where month>6 and mo nth<10)as quarter3 from store where month>0 and month<4 group by id; +------+----------+----------+----------+ | id | quarter1 | quarter2 | quarter3 | +------+----------+----------+----------+ | 1 | 400 | 1100 | 1640 | | 2 | 900 | 1100 | 1640 | +------+----------+----------+----------+ 2 rows in set (0.00 sec) tel me how to rectify it.
What are the functions used to encrypt and decrypt the data present in mysql?
What is insert query in mysql?
How to Join tables on common columns.