Friday 18 October 2013

Create Table with primary key

In Sql query prompt write down below code example
 
create table student
   (roll_no int  not null,
   name varchar(10),
  class varchar(10),
   birthdate date,
   primary key(roll_no)
   ) ;


Create Table with primary key and check and null Constrain

create table course
  (course_no int not null primary key,
  course_name varchar(20),
  max_marks int,
  pass_marks int,
  check (max_marks>0 and max_marks<100));

Create Table with Foreign Key

create table sc
     (roll_no int,
      course_no int,
     marks int,
     foreign key(roll_no) references student(roll_no),
    foreign key(course_no) references course(course_no))  ;

No comments:

Post a Comment

How to change Background color by selecting color from Listview

activitymain.xml file::> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     xm...