"Om Swastiastu"
If you have study about the Introduction of Database before, then, you have to practice to make a table. This is the example of Rep Table. Write this syntax on your SQL 2000 Query Analyzer.
CREATE TABLE Rep(
RepNum INT NOT NULL UNIQUE,
LastName VARCHAR(25),
FirstName VARCHAR(25),
Street VARCHAR(30),
City VARCHAR(20),
State VARCHAR(2),
Zip VARCHAR(5),
Commision DECIMAL(10,2),
PRIMARY KEY (RepNum)
);
After you write the syntax above on your Query Analyzer, press F5 to run it. There's a notification that the program run successful if the syntax is correct. Next, delete the syntax above and replace with this syntax.
SELECT * FROM Rep
SELECT City FROM Rep
SELECT FisrtName, LastName FROM Rep
Press F5 again to run that syntax. Okay, now I will explain about the syntax above.
- SELECT * FROM Rep
- this mean we show all the column from Rep Table.
- SELECT City FROM Rep
- this mean we only show the City column from Rep Table.
- SELECT FirstName, LastName FROM Rep
- this mean we only show the FirstName and LastName column from Rep Table.
Use this syntax to sort the column that you want sort by.
SELECT RepNum, FirstName, LastName
FROM Rep
ORDER BY RepNum
Okay, that's all about Creating Table in SQL. Thanks for you kind attention. If there's any critical or suggestion, please write on the box below. Keep visiting IT Programmer.
"Om Santhi, Santhi, Santhi, Om"
Comments:
Post a Comment