Tuple, Attribute, Degree, Cardinality
Tuple, Attribute, Degree, Cardinality
Tuple, Attribute, Degree, Cardinality
SQL commands
1 Adam 34 13000
Creating a Database
To create a database in RD BMS, create command is used.
Following is the syntax,
CREATE DATABASE <DB_NAME>;
Example for creating Database
CREATE DATABASE Test;
The above command will create a database named Test,
which will be an empty schema without any table.
Using ALTER command we can add a column to any existing table. Following is the syntax,
Both the statements below will insert NULL value into age
column of the student table.
101 Adam 15
Also, if you run the below query, it will insert default value into
the age column, whatever the default value may be.
Let's learn about the syntax and usage of the UPDATE command.
UPDATE command
UPDATE command is used to update any record of data in a table.
Following is its general syntax,
In the above statement, if we do not use the WHERE clause, then our update query will
update age for all the columns of the table to 18.
s_id nameage
101 Adam 15
102 Alex 18
103 Abhi 17
Let's study about the syntax and the usage of the Delete
command.
SELECT
column_name1,
column_name2,
column_name3,
...
column_nameN
FROM table_name;
Let's write a simple SQL query to display the record for student with s_id as 101.
SELECT s_id,
name,
age,
address
FROM student WHERE s_id = 101;
Following will be the result of the above query.
SELECT s_id,
name,
age,
address
FROM student WHERE name = 'Adam';
Following will be the result of the above query.
Wildcard operators
There are two wildcard operators that are used in LIKE clause.