what is primary key,unique key, foreign key? can u teach me
in simple language?
Answer Posted / sandeep beniwal (master)
Primary key:- Primary key means main key. A primary key is
one which uniquely identifies of a table. Prrimay key does
not allow null values and duplicate values.
e.g:
empno empname status
10 dipender active
20 nisha inactive
30 vikas active
40 naveen active
Pimary key not like this:
10 dipender active
20 nisha inactive
30 vikas active
naveen active ........ (duplicate value)
Unique key:-A unique is one which uniquely identifies a row
of a table, but there is a difference like it will allow
only one duplicate values (In sql).
Both will function in a similar way but a slight difference
will be there. So, decalaring it as a primary key is the
best one.
foreign key:- a foreign key is one which will refer to a
primary key of another table and helps making link
e.g
employee_table user_table
empID empname status userID userID empname
10 dipender active 1 1 dipender
20 nisha inactive 2 2 nisha
30 vikas active 3 3 vikas
40 naveen active 4 4 naveen
In the above relation, userID is there in employee_table
which
is a primary key of user_table. that means, userID is
refering the user_table.
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
What is difference between server and database?
What is a sequence? Explain it with one example?
Explain alternate key?
Differentiate between delete and truncate table?
What will happen non-clustered index will be created on clustered index?
what is transaction state, buffer management, shadow paging
how do you do sql tuning?
london school of science and technology has a software development unit,known as lsst solutions,which is responsible for developing and implementing software throughout the collegejames tristan keeps a record of all student details in the college including student id,name,and start date and phone number.There are many courses offered by LSST. For example MBA, MSc, BSc, BABS, DF, English etc. Each course id identified by course id, description, duration. Each course has many semesters. Each semester takes place during a particular term. Semester details and term details are required to be stored in the database. Each course has many subjects and same subject may be offered in many courses. For each subject many details such as Subject code, name, result and attendance are required to be stored. Every subject has mainly two assessments; one assignment and one exam. Assignment is worth of 30% and exam 70% respectively. You have been appointed as a database designer. Your job is to provide ERD with all possible entities and relationships. Note: Feel free to make necessary assumptions 3: Assignment Tasks. 1. Create an ERD for the above problem 2. Translate the ERD to Relational Data model (RDM) 3. Implement the RDM by creating the tables 4. Populate the database with your own data. 5. SQL Queries for the following tasks a. List all student details in each course along with course details b. Count and display number of students in each course. c. List student name, course name, assessment description, marks for all students.
Hi, I want do a course in DWH Informatica Administrator and Abinito Administrator please tell me some institute in chennai and i am searching for a job,so please help me and my mail id : satty_rh@yahoo.co.in Thanks, Kumar
query to Compare data of two tables between two different Databases(Oracle and SQL Server) Eg., Source Database: Oracle Table: Employee Target Database : SQL Server Table : emp
Under which circumstance should you create an index on a table?
Two tables emp(empid,name,deptid,sal) and dept(deptid,deptname) are there.write a query which displays empname,corresponding deptname also display those employee names who donot belong to any dept.
how can we view column head in first page but not in remaining pages?
Explain transaction manager?
diff b/w inter process and in process