Skip to main content

SQL

Learning new things is my hoby. 
Another thing I amlearning is SQL. Of course when I find some time...

Basic SQL commands to manage the databases:

➤ To list all the database, tables and objectives:
SELECT * FROM sys.tables
SELECT * FROM sys.databases
SELECT * FROM sys.objects

➤ To create database:
CREATE DATABASE Name_of_the_Database; 

➤ To use the database we created:
USE Name_of_the_Database;

➤ To create table:
CREATE TABLE Name_of_the_Table (Name_of_the_FIRST_column data_specification Name_of_the_SECOND_column data_specification
... );

➤ To insert data to a specific columns:
INSERT INTO Table_Name (Column_Name_1, Column_Name_2) VALUES ("Value_1", Value_2);

➤ To update a data:
UPDATE Table_Name SET Column_Name= New_Data WHERE Row_Number = Number_of_the_Row;

➤ To delete a data:
DELETE FROM Table_Name WHERE Row_Number = Number_of_the_Row;


➤ To delete a database:
DROP DATABASE Database_Name;
If you take error messsage because of your database is not empty, you need to delete the tables inside first:

DROP TABLE Table_Name;
____________________________
My way to publish something here:
  1. Post something on blog.
  2. Then update the pages if the post is about one of the pages in the "pages" section.
  3. The period between the first and the second line may be takes a few days or weeks.
So if you search the entire site, may be you can find out more.

Comments