Posts

Showing posts from January, 2023

SQL simple Queries to create Database & Tables and Insert Values

   SQL Queries to create Database & Tables # Creating ABC_College database and tables CREATE DATABASE ABC_College; USE ABC_College; # Creating course table CREATE TABLE COURSE(     coursecode varchar(5) NOT NULL PRIMARY KEY,     title varchar(20) NOT NULL,     school varchar(20) NOT NULL ); # Creating student table CREATE TABLE student (     regno varchar(6) NOT NULL PRIMARY KEY,     name varchar(20) NOT NULL,     DOB date NOT NULL,     telno varchar(20) NOT NULL,     Coursecode varchar(10) NOT NULL,     FOREIGN KEY(Coursecode) REFERENCES COURSE(Coursecode) ); # Creating unit table CREATE TABLE UNIT(     unitcode varchar(5) NOT NULL PRIMARY KEY,     title varchar (20) NOT NULL,     year int NOT NULL ); # Creating results table CREATE TABLE RESULTS(     regno varchar(6) NOT NULL,     unitcode varchar(5) NOT NULL,     exammark ...