0% found this document useful (0 votes)
69 views3 pages

INSERT Data in Branch:: INSERT Into Private Owner

The document contains sample SQL statements for inserting data into database tables for branches and private owners. It also contains example queries for searching, filtering, ordering, and performing calculations on data in the Staff table.

Uploaded by

Aisha Batool
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views3 pages

INSERT Data in Branch:: INSERT Into Private Owner

The document contains sample SQL statements for inserting data into database tables for branches and private owners. It also contains example queries for searching, filtering, ordering, and performing calculations on data in the Staff table.

Uploaded by

Aisha Batool
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

INSERT data in Branch:

INSERT INTO `branch`(`branchNo`, `street`, `city`, `postcode`) VALUES ('B002', '56 Clover Dr', 'London', 'NW10 6EU');

INSERT INTO `branch`(`branchNo`, `street`, `city`, `postcode`) VALUES ('B003', '163 Main St', 'Glasgow', 'BS99 1NZ');

INSERT INTO `branch`(`branchNo`, `street`, `city`, `postcode`) VALUES ('B004', '32 Manse Rd', 'Bristol', 'G11 9QX');

INSERT INTO `branch`(`branchNo`, `street`, `city`, `postcode`) VALUES ('B005', '22 Deer Rd', 'London', 'SW1 4EH');

INSERT INTO `branch`(`branchNo`, `street`, `city`, `postcode`) VALUES ('B007', '16 Argyll St', 'Aberdeen', 'AB2 3SU');

INSERT into Private owner:

INSERT INTO `privateowner`(`ownerNo`, `fName`, `lName`, `telNo`, `eMail`, `password`) VALUES ('CO40', 'Tina', 'Murphy',
0141-943-1728, '[email protected]', '63 Well St', 'Glasgow G42', '********');

INSERT INTO `privateowner`(`ownerNo`, `fName`, `lName`, `telNo`, `eMail`, `password`) VALUES ('CO46', 'Joe', 'Keogh',
01224-861212, '2 Fergus Dr,Aberdeen AB2 7SX', '[email protected]', '********');

INSERT INTO `privateowner`(`ownerNo`, `fName`, `lName`, `telNo`, `eMail`, `password`) VALUES ('CO87', 'Carol', 0141-
357-7419, 'Farrel 6 Achray St, Glasgow G32 9DX', '[email protected]', '********');

INSERT INTO `privateowner`(`ownerNo`, `fName`, `lName`, `telNo`, `eMail`, `password`) VALUES ('CO93', 'Tony', 'Shaw',
0141-225-7025, '12 Park Pl, Glasgow G4 0QR', '[email protected]', '********');

LIKE:

S.No Query Function


1 (Row) SELECT staffNo, fName, lName, Position  Search membership, IN/NOT
FROM Staff  IN
WHERE Position = 'Manager' OR Position = 'Assistant'
SELECT staffNo, fName, lName, position  --
FROM Staff 
WHERE Position IN ('Manager', 'Assistant')
2 SELECT ownerNo, fName, lName, telNo, Address Match Pattern
FROM privateowner
WHERE Address LIKE '%Glasgow%'
3 SELECT staffNo, fName, lName, Position, salary  Range search condition
FROM Staff 
WHERE salary BETWEEN 20000 AND 30000
SELECT staffNo, fName, lName, Position, salary  ---
FROM Staff 
WHERE salary >20000 AND salary <30000
4 SELECT staffNo, fName, lName, Position, salary Comparison Search Condition
 FROM Staff 
WHERE salary > 10000
SELECT *  ---
FROM Branch 
WHERE city = 'London' OR city = 'Glasgow'
5 (Field) SELECT staffNo, fName, lName,salary, salary/1000  Calculated Fields
FROM Staff
SELECT staffNo, fName, lName, salary/12 AS monthlySalary  ---
FROM Staff
ORDER BY
S.No Query Function
SELECT lName, salary, branchNo  ORDER By on more than one attribute.
FROM staff Minor sort key
ORDER BY salary DESC, branchNo DESC
SELECT COUNT(staffNo) AS myCount, SUM(salary) AS mySum  MIN,SUM
FROM Staff
 WHERE Position = 'Manager'
Random Queries:
ALTER TABLE `Viewing` ADD `Comment` VARCHAR(255) NULL DEFAULT NULL AFTER `viewDate`;

UPDATE `viewing` SET `Comment`='too remote' WHERE clientNo = 'CR76';

You might also like