Monday, 6 June 2016

SQL Query Of Today's Quiz 6/6/2016

SQL Query Of Today's Quiz


create table  CUSTOMER786(
cUSTOMER_ID vARCHAR(20) NOT NULL,
nAME vARCHAR(20),
c_ADDRESS VARCHAR(20),
cONTACT INT NOT NULL,
c_ORDER_ID vARCHAR(20)
pRIMARY KEY (cUSTOMER_ID,C_oRDER_ID))
INSERT INTO CUSTOMER786 VALUES
('cs-113','SLEEM','ISB',21457,'O-114');
 SELECT * FROM CUSTOMER786;
 SELECT cUSTOMER786.nAME,cUSTOMER786.c_ADDRESS,ORDERS786.No_OF_ITEM
 FROM CUSTOMER786,oRDERS786;
 uPDATE CUSTOMER786
 sET C_ADDRESS='rWP'
 WHERE nAME='ISB';
CREATE TABLE ORDERS786(
C_ORDER_ID VARCHAR(20),
CUSTOMER_ID VARCHAR(20),
nO_OF_ITEM INT NOT NULL,
pRODUCT_ID vARCHAR(20),
pRODUCT_dESCRIPTION VARCHAR(20),
aMOUNT INT NOT NULL,
PRIMARY KEY(pRODUCT_ID),
fOREIGN KEY(cUSTOMER_ID,C_oRDER_ID) REFERENCES cUSTOMER786(cUSTOMER_ID,C_oRDER_ID));
aLTER TABLE ORDERS786
aDD MANUFACTURERS vARCHAR(20);
INSERT INTO ORDERS786 VALUES('O-112','CS-111',10,'P-113','SOAP',300,'man');
SELECT * FROM ORDERS786;
sELECT CUSTOMER_ID FROM ORDERS786
WHERE pRODUCT_dESCRIPTION='sOAP' aND pRODUCT_dESCRIPTION='SHAMPOO';
cREATE TABLE pRODUCT786(
pRODUCT_ID VARCHAR(20),
pRODUCT_dESCRIPTION vARCHAR(20)
pRIMARY KEY (pRODUCT_ID));
INSERT INTO pRODUCT786 VALUES('P-114','TOOTH PAST');
SELECT * FROM pRODUCT786;