📜  javascript 循环数组 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:45.998000             🧑  作者: Mango

代码示例10
CREATE DATABASE  pat;

SHOW DATABASES; 

USE pat;

create table patientd ( 
    pno int not null primary key auto_increment, 
    patientname varchar (100) not null, 
    phoneno varchar (10) not null, 
    residence varchar(50) not null, 
    nationality varchar(50) not null,
    diseases varchar(50) not null, 
    gender varchar(6) not null, 
    comments varchar(50) not null
    );    
    
ALTER TABLE patientd ADD DateofBirth date  AFTER  residence;

ALTER TABLE patientd DROP COLUMN phoneno;

ALTER TABLE patientd CHANGE comments  comments text;

DESCRIBE patientd;

Insert into patientd (pno, patientname,residence,DateofBirth,nationality,diseases,gender,comments) values (NULL, 'Ssebakijje','Ntinda','1978-06-12', 'Ugandan','malaria','Male','Diabetic');

Insert into patientd values (NULL, 'Nandujja', 'Makindye','1952-03-29', 'Kenyan','Bacterial Infection','Female','High Blood Pressure');

SELECT * from patientd;

SELECT pno, patientname from patientd;

SELECT DISTINCT nationality  from patientd;

select * from patientd where DateofBirth < "1950-01-01";

SELECT * FROM patientd  WHERE  Patientname = 'Ssebakijje';

Select * FROM patientd  WHERE  Patientname  LIKE  'S%';

Select * FROM patientd  WHERE  Patientname  LIKE  '%a';

Insert into patientd values (NULL, 'Mugabe', 'State house','1920-01-01', 'Zimbabwe','Viral Infection','Male','Diabetic, High Blood Pressure');


SELECT * from patientd WHERE nationality BETWEEN 'Kenyan' AND 'Ugandan';

SELECT * FROM patientd ORDER BY patientname DESC;

UPDATE patientd SET patientname='Nanyonjo',gender='Female' WHERE  pno=1 AND patientname = 'Ssebakijje';

DELETE FROM patientd WHERE patientname = 'Nanyonjo';

TRUNCATE TABLE patientd;

Insert into patientd (pno, patientname,residence,DateofBirth,nationality,diseases,gender,comments) values (NULL, 'Ssebakijje','Ntinda','1978-06-12', 'Ugandan','malaria','Male','Diabetic');

Insert into patientd values (NULL, 'Nandujja', 'Makindye','1952-03-29', 'Kenyan','Bacterial Infection','female','High Blood Pressure');

Insert into patientd values (NULL, 'Mugabe', 'State house','1920-01-01', 'Zimbabwe','Viral Infection','Male','Diabetic, High Blood Pressure');



SELECT patientd.pno, patientd.patientname, doctor.docname FROM patientd INNER JOIN doctor ON patientd.pno=doctor.pno ORDER BY patientd.patientname; 

SELECT * FROM patientd INNER JOIN doctor ON patientd.pno=doctor.pno

SELECT patientd.pno, patientd.patientname, doctor.docname FROM patientd LEFT JOIN doctor ON patientd.pno=doctor.pno ORDER BY patientd.patientname; 

SELECT * FROM patientd LEFT JOIN doctor ON patientd.pno=doctor.pno 

SELECT patientd.pno, patientd.patientname, doctor.docname FROM patientd RIGHT JOIN doctor ON patientd.pno=doctor.pno ORDER BY patientd.patientname; 

SELECT * FROM patientd RIGHT JOIN doctor  ON patientd.pno=doctor.pno;

SELECT patientd.pno, patientd.patientname, doctor.docname FROM patientd FULL JOIN doctor ON patientd.pno=doctor.pno ORDER BY patientd.patientname;

SELECT * FROM patientd FULL JOIN doctor ON patientd.pno=doctor.pno;

SELECT patientd.pno, patientd.patientname, doctor.docname FROM patientd LEFT JOIN doctor ON patientd.pno=doctor.pno
UNION 
SELECT patientd.pno, patientd.patientname, doctor.docname FROM patientd RIGHT JOIN doctor ON patientd.pno=doctor.pno;

SELECT * FROM patientd LEFT JOIN doctor ON patientd.pno=doctor.pno
UNION 
SELECT * FROM patientd RIGHT JOIN doctor ON patientd.pno=doctor.pno;

CREATE TABLE doctor(
    docno int not null primary key auto_increment,
    docname varchar(50) not null,
    pno int(11) not null
);

INSERT INTO doctor VALUES(null, 'Timothy', 1);
INSERT INTO doctor VALUES(null, 'Musa', 2);
INSERT INTO doctor VALUES(null, 'Apuli', 3);
INSERT INTO doctor VALUES(null, 'Ssemujju', 5);

Insert into patientd values (NULL, 'Ms Isabel dos Santos', 'State house','1980-01-01', 'Angola','Viral Infection','Female','Ulcers');


INSERT INTO doctor VALUES(null, 'Mugalu', 3);

INSERT INTO doctor VALUES(null, 'Mugalu', 3);

Select * FROM patientd  WHERE  Patientname  LIKE  '________';