Tuesday, April 17, 2012

Primary Key

Primary Key:
A primary key is a field or combination of fields that uniquely identify a record in a table, so that an individual record can be located without confusion.
http://www.databasedev.co.uk/primary_foreign_key_constraints.html


A primary key is one which uniquely identifies a row of a table. this key does not allow null values and also does not allow duplicate values
http://www.allinterview.com/showanswers/15625.html


A primary key in a database, is simply a useful device (key) that makes each record unique.
Read more: http://wiki.answers.com/Q/What_is_the_purpose_of_a_primary_key_in_a_database#ixzz1sIudT06W

foreign key

foreign key - a foreign key is one which will refer to a primary key of another table
http://www.allinterview.com/showanswers/15625.html

A foreign key is a relationship or link between two tables which ensures that the data stored in a database is consistent.
The foreign key link is set up by matching columns in one table (the child) to the primary key columns in another table (the parent)
http://www.visualcase.com/kbase/database_basics_-_foreign_keys.htm


Foreign Key:
A foreign key (sometimes called a referencing key) is a key used to link two tables together.
Typically you take the primary key field from one table and insert it into the other table where it becomes a foreign key
(it remains a primary key in the original table).

A foreign key constraint specifies that the data in a foreign key must match the data in the primary key of the linked table, in the above example we couldn't set the DeptID in the Employee table to 04 as there is no DeptID of 04 in the Department table. This system is called referential integrity, it is to ensure that the data entered is correct and not orphaned (i.e. there are no broken links between data in the tables)
http://www.databasedev.co.uk/primary_foreign_key_constraints.html

EXISTS Condition

EXISTS Condition

The EXISTS condition is considered "to be met" if the subquery returns at least one row.

The syntax for the EXISTS condition is:

SELECT columns
FROM tables
WHERE EXISTS ( subquery );




Example #1:

Let's take a look at a simple example. The following is an SQL statement that uses the EXISTS condition:

SELECT *
FROM suppliers
WHERE EXISTS
(select *
from orders
where suppliers.supplier_id = orders.supplier_id);

This select statement will return all records from the suppliers table where there is at least one record in the orders table with the same supplier_id.



Example #2 - NOT EXISTS:

The EXISTS condition can also be combined with the NOT operator.

For example,

SELECT *
FROM suppliers
WHERE not exists (select * from orders Where suppliers.supplier_id = orders.supplier_id);

This will return all records from the suppliers table where there are no records in the orders table for the given supplier_id.

http://www.techonthenet.com/sql/exists.php

what is multiprogramming ?


  • what is multiprogramming ?


Multiprogramming is a rudimentary form of parallel processing in which several programs are run at the same time on a uniprocessor.
Since there is only one processor , there can be no true simultaneous execution of different programs.
Instead, the operating system executes part of one program, then part of another, and so on.
To the user it appears that all programs are executing at the same time.




  • What are the advantages of multiprogramming?

Multiprogramming makes effifcient use of the CPU by overlapping the demands for the CPU and its I/O devices from various users. It attempts to increase CPU utilization by always having something for the CPU to execute
http://wiki.answers.com/Q/What_are_the_advantages_of_multiprogramming



  • What is the advantage of Multiprogramming?

Multiprogramming increases CPU utilization by organizing jobs so that the CPU always has one to execute.
Several jobs are placed in the main memory and the processor is switched from job to job as needed to keep several jobs advancing while keeping the
peripheral devices in use.
Multiprogramming is the first instance where the Operating system must make decisions for the users.
Therefore they are fairly sophisticated.