DAY-1: EXAMPLE-1


Student Table

Key word: Select, Create, Insert
Schema:

Entity/Field Name
Data Type
Student_id
Number(10)
Name
Varchar2(30)
Program_id
Varchar2(15)
City
Varchar2(15)
Division
Varchar2(15)
Country
Varchar2(15)

DDL for Create Above Table:

SQL>create table student
(student_id number(10),
name varchar2(30),   
program_id varchar2(15),
city varchar2(15),
division varchar2(15),
country varchar2(15)
);

After created the student table, naturally we may try to insert some values or data. It’s a natural sense to keep data in database for further use. To see the inserted data, the SELECT command is only one way according to the SQL statement writing rule.

Insert Value for Above Table:

SQL> insert into student
    values(200819222,'Adina Bashar','English','Noakhali','Chittgong','Bangladesh');

Using the above command Insert some values as you like. After that or after some moments you may see your data. Use the below statement to see your inserted data or value/records. There are lots of styles of inserting values to the table. Visit HERE to get more ideas of insert command.


View or See Value from Above Table:

SQL> select * from student;
The above statement will return all records with all field from student table.

SQL> select student_id,name from student;
The above SQL command will return only student_id and name of all students.

SQL> select name, city from student where student_id=200819222;
The above SQL command will return only name and city of a student whose id is 200819222.

Click HERE to view more example of SELECT command


In Day-1, our target is to understand the SQL, not to know create, insert or any other SQL command. We will discuss for those with details. The day is only to understand the SQL and the three clauses of SQL statement. They are SELECT, FROM and WHERE and also their implementation.

Some Things You Must Know about Database Management related to SQL. <<CLICK HERE>>

No comments:

Post a Comment

Popular Posts