It is currently Fri Jul 30, 2010 1:59 pm


All times are UTC [ DST ]


Ask on Codemiles community and get answers Free and Fast :

SQLServer codes,SQLServer tricks ,SQLServer faq ,SQLServer answers .and more

Our guest share with us your code snippets , your programming problems , your open source projects ,read articles and post yours .







Post new topic Reply to topic  [ 1 post ] 
  Print view Previous topic | Next topic 
Author Message
 Post subject: Step-1- in SQl-server2000
PostPosted: Sat Apr 07, 2007 6:43 pm 
Offline
Newbie
User avatar

Joined: Thu Apr 05, 2007 9:57 pm
Posts: 17
Has thanked: 0 time
Have thanks: 0 time

ط·آ£ط¢آ¢ط£آ¢أ¢â‚¬ع‘ط¢آ¬ط·آ¢ط¢آ¢ SQL Server has 2 types of Databases :
1. System Tables: Store Information about SQL server as a whole
2. User Tables : Databses that user creates

ط·آ£ط¢آ¢ط£آ¢أ¢â‚¬ع‘ط¢آ¬ط·آ¢ط¢آ¢ Installing SQL Server creates system tables ( as in master DB) and sample user databases such as:
(master , model , tempdb , msdb , distribution , pubs and Northwind)

ط·آ£ط¢آ¢ط£آ¢أ¢â‚¬ع‘ط¢آ¬ط·آ¢ط¢آ¢ There are 3 types of statements to use in SQL :
1. DDL Statements : Create and Drop Tables , Views , Indexes and Constarints
3. DML Statements: Insert , Update , Delete and Select from Tables or Views
3. DCL Statements : Create and Drop Users or Roles + Grant and Revoke Privileges
4. DCL Statements .


ط·آ£ط¢آ¢ط£آ¢أ¢â‚¬ع‘ط¢آ¬ط·آ¢ط¢آ¢ Environment of SQL Server:
1. Service Manager : To Start , Stop or Pause Server
2. Enterprise Manager : To do all SQL functions through interface
3. Query Analyzer :To do all SQL functions by hand (writing statements)


DDL Statements

On both Enterprise Manager & Query Analyzer

1.Creating Tables

Used to create a table with a specific structure inside a selected database

Code:
CREATE  TABLE <tablename>
<column name> <data type> [<column constraint>ط·آ£ط¢آ¢ط£آ¢أ¢â‚¬ع‘ط¢آ¬ط·آ¢ط¢آ¦]
PRIMARY KEY <column list>
FOREIGN KEY <column list> REFERENCES <table specifications>


Example:

Code:
CREATE TABLE STAFF
(
  STAFF_ID int Primary Key,
  STAFF_NAME char(20) Not Null,
  STAFF_SALARY real Null,
  STAFF_PHOTO image Null
);


2. Dropping Tables

Used to remove a table from a selected database

Code:
DROP TABLE <tablename>


Example:

Code:
DROP TABLE STAFF;



3. Altering Tables

Used to change the table structure

Code:
ALTER TABLE <tablename>
ADD [column] <column name><data type>
DROP [column] <column name>


Example:

Add the column STAFF_EMAIL to the table STAFF
Code:
ALTER TABLE STAFF
ADD STAFF_EMAIL char(30);


Example:


Remove the column STAFF_EMAIL from the table STAFF
Code:
ALTER TABLE STAFF
DROP COLUMN STAFF_EMAIL;



TOP
 Profile Send private message  
 
| More
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 


 Similar topics
 Topic title   Forum   Author   Replies 
 unit step and impulse function L.T  General Discussion  loomy  0
 (MS Press) Microsoft Visual CSharp 2008 - Step By Step  offers  Casper  0
 Cisco - Press - Configuring CallManager and Unity A Step-by-  offers  Casper  0
 TCP IP First Step  offers  Casper  0
 Cisco Press - Routing First-Step 2004  offers  Casper  0

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  





Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2009
mileX v1.0 designed by codemiles team