SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE IF NOT EXISTS `pacientes` ( `id` int(6) unsigned NOT NULL, `rev` int(3) unsigned NOT NULL, `rut` varchar(200) NOT NULL, PRIMARY KEY (`id`,`rev`) ) DEFAULT CHARSET=utf8; INSERT INTO `pacientes` (`id`, `rev`, `rut`) VALUES ('1', '1', 'The earth is flat'), ('2', '1', 'One hundred angels can dance on the head of a pin'), ('1', '2', 'The earth is flat and rests on a bull\'s horn'), ('1', '3', '44477747-4'), ('4', '4', '96610670-0'); CREATE TABLE IF NOT EXISTS `seguimiento` ( `idseg` int(6) unsigned NOT NULL, `rutseg` varchar(200) NOT NULL, PRIMARY KEY (`idseg`,`rutseg`) ) DEFAULT CHARSET=utf8; INSERT INTO `seguimiento` (`idseg`, `rutseg`) VALUES ('1', '96610670-0'), ('4', '96610670-0'), ('3', '44477747-4') ; select pacientes.rut from pacientes where pacientes.rut in (select seguimiento.rutseg from seguimiento) and rut="96610670-0"
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear