create sql table with primary key and foreign key

create sql table with primary key and foreign key 

In this section "create sql table with primary key and foreign key "  we will learn how to create a table in Oracle SQL Plus. Before you create table in Sql Plus , you need to decide the name of the table and various columns names and data types of the columns.

Lets us take example of Student table , here you can decide name of the table as student and it could have columns as rollno, name, fees . Data type of rollno column could be either number or char , the data type of name column must be varchar2 type and datatype of fees column must be number.

The general syntax of create table in SQL SQL> create table <table name> ( column1 specification, column2 specification...);

The sql code to create above student table will be like this:
SQL> create table student (rollno number(3), Name varchar2(20), fees Number(8,2));

This way you can create any table in SQL.

In above example rollno column can be made primary key like this:

SQL> create table student (rollno number(3) primary key, Name varchar2(20), fees Number(8,2));
Summary

This post  create sql table with primary key and foreign key needs your social media share. This will encourage us to arrange more stuff like this for readers.