@senith

SQL-1

December 06, 2021 · SQL
-- create a table
CREATE TABLE students (
  id INTEGER PRIMARY KEY,
  name TEXT NOT NULL,
  gender TEXT NOT NULL
);
-- insert some values
INSERT INTO students VALUES (1, 'Ryan', 'M');
INSERT INTO students VALUES (2, 'Joanna', 'F');
-- fetch some values
SELECT * FROM students WHERE gender = 'F';

Code 1

November 21, 2021 · SQL
CREATE TABLE employee(eid int(5) not null,
                      name varchar(60),
                      NIC varchar(10),
                      did int(5),
                      Salary decimal,
                      PRIMARY KEY(eid)
                      FOREIGN KEY(did) REFERENCES department(did));
                      
INSERT INTO employee VALUES (1, "Nimal", 1000234762,1,200000),
                            (2, "Pasan", 1000234763,1,200000),
                            (3, "Sahan", 10002347