Sunday, 28 April 2013

SQL UPDATE



SQL UPDATE

The UPDATE Statement is used to modify the existing records in a table.

The Syntax is:

UPDATE table_name  SET column1 = value1, column2 = value2, ...
[WHERE condition]

Example:

UPDATE student SET  fname = 'Khadim' WHERE lname= 'Hussain'


 
OR

UPDATE student SET  fname = 'Abdul', lname= 'Basit', dob='10/11/1983'
WHERE reg_no='1003'

SQL INSERT



INSERT INTO:
This sql command is used to add data into the fields (columns) of table
INSERT INTO table-name [column1, column2,......] VALUES (value1, value2,.....)


Examples
INSERT INTO student VALUES ('12-2800','HAMID','ALI',25)

INSERT INTO student (sid, fname, lname) VALUES ('12-2800','HAMID','ALI')

Friday, 26 April 2013

Database Definitions

Dear visitors!

This blog is created for students who studying Database System as well as Distributed Database System.

This blog is helping in SQL commands, syntax, examples and applications




What is database?


Database is an organized collection of logically related data
1.      Data: Stored representation of objects and events that have meaning and importance in user’s environment.
*    Objects and events are those things for which user/organization wants to store some data. e.g. Assume you are going to build database of university; then you must have to store the data about students, registration, examination, faculty, etc. Here individual students and faculty members are object for which data (name, age, address, etc) should be represented. Registration and Examination are two events for which data should be represented.
2.      Logically Related data: Logically related data means data should be relevant in some context and irrelevant data must not be included (collected).
Example:
*   Assume you are going to collect the data of student in University system: In University system; student name, age, qualification, father name will be logically related and should be included (collected) in this system. While no. of his/her sisters, no. of his/her brothers is not related in the context of University system. Even this is also data about student but logically not related in the context of University system. Hence, this data should not be included in University system.
3.      Organized Collection: Organized collection means data should be arranged/structured in such a way that one can effectively process it when necessary.
Example: Data about student
Unorganized:
AmirRawalpindi122, AslamIslamabad1224; Here, name, city, roll no, and age of student is collected in unorganized fashion. Some one cannot process it due to unstructured nature of data. It is difficult to distinguish between name and city then between roll no and age.
Organized:
Amir#Rawalpindi#1#22## Aslam#Islamabad12#24   or
Amir
Rawalpindi
1
22
Aslam
Islamabad
12
24

What is a Distributed Database System?
A distributed database system is a collection of multiple, logically interrelated databases distributed over a computer network.
 
This is beginning and change occur accordingly.
Your suggestions are warmly welcome!