rbi-learning / Today-I-Learned

1 stars 0 forks source link

Today I Learned (August 13th) #133

Open farhan310 opened 4 years ago

farhan310 commented 4 years ago

Today I Learned:

SQL

Below are a few examples of the commands we learned to query data using SQL:

Creating a new table: CREATE TABLE tablename ( Column_name 1 datatype serial PRIMARY KEY, Column_name 2 datatype varchar(128) NOT NULL, Column_name 3 datatype interger );

Inserting data within table: INSERT tablename (column1) VALUE (value1)

In order to select all the data from within a table, we can use: SELECT * FROM table-name;

Deleting Data DELETE tablename WHERE (criteria);

Ordering Data SELECT column1, column 2, column 3 FROM table-name ORDER BY column1 AESC or DESC;

Updating data within a table: UPDATE tablename SET column1 = value1 WHERE (criteria);