truncate table sensors restart identity;
select * from garbages;
select * from garbages;
truncate table sensors restart identity;
\q
create database conalep with owner = root
;
\@
\q
\d subcontracts
\d users
\d subcontracts
\d users
\d contracts
\q
select id,name from institutions
;
select id,name from institutions where name ilike '%aplica%';
delete from students where institution_id = 30;
delete from tutors where institution_id = 30;
delete from students where institution_id = 30;
delete from tutors where institution_id = 30;
select count(*) from students where institution_id = 30
;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
select count(*) from students where institution_id = 30;
\q
\d messages
\d messages_users
\d messages
\@
\@
\q
\d users
\d users
delete from tutors
;
delete from students
;
\d tutors
\d tutors
select * from tutors;
\d students
\q
\d students
\d tutors
\d students
\d messages_users
\d messages
\d tutors
\q
\d messages
select attachment from messages;
select url from messages;
select attachment_folder from messages;
select attachment from messages;
\d tutors
\q
\d
\q
CREATE TABLE courses (
 id serial primary key,
 name varchar(150),
 active boolean default true,
 created timestamp with time zone DEFAULT now(),
 institution_id bigint
);
CREATE TABLE teachings (
 id serial primary key,
 level1 varchar(50),
 level2 varchar(50),
 level3 varchar(50),
 active boolean default true,
 created timestamp with time zone DEFAULT now(),
 user_id bigint,
 institution_id bigint
);
CREATE TABLE teachings_courses (
 id serial primary key,
 active boolean default true,
 created timestamp with time zone DEFAULT now(),
 teaching_id bigint,
 course_id bigint,
 user_id bigint,
 institution_id bigint
);
CREATE TABLE homeworks (
 id serial primary key,
 files varchar(255),
 urls varchar(255),
 msg text,
 level1 varchar(50),
 level2 varchar(50),
 level3 varchar(50),
 active boolean default true,
 created timestamp with time zone DEFAULT now(),
 teachings_course_id bigint,
 course_id bigint,
 user_id bigint,
 institution_id bigint
);
CREATE TABLE homeworks_students (
 id serial primary key,
 pics varchar(255),
 docs varchar(255),
 msg varchar(255),
 status integer default 0,
 active boolean default true,
 created timestamp with time zone DEFAULT now(),
 tutor_id bigint,
 student_id bigint,
 homework_id bigint,
 institution_id bigint
);
ALTER TABLE homeworks_students ADD COLUMN obs varchar(100);
\q
\d payments
select * from sales;
select count(*) from sales;
\@
\q
\dt
\d extracurriculars_students
\d extracurriculars
\d extracurriculars
\d extracurriculars_students
select * from users;
\d promotions
select attributes,attribute2 from promotions;
select * from promotions
;
select attributes,attribute2 from promotions;
\d promotions
\q
\dt
\d monitories_details
\d monitories
\d monitories_details
\d monitories
\d monitories
\d monitories_details
\d monitories_registers
\d monitories
\dt
\d monitories_details
\d monitories
\d monitories_details
\@
\q
\d messages_registers
\q
\d equipments
\d equipments
\q
\d equipment_categories
\d equipments
select * from equipments;
select * from equipments where id = 6; 
delete from equipments where id > = 6;
delete from equipments where id >= 6;
select * from equipment_categories
;
select * from equipment_categories
;
delete from equipment_categories where id >= 3;
delete from equipment_categories where id >= 3;
delete from equipment_categories where id >= 3;
delete from equipments where id >= 6;
delete from equipments where id >= 6;
delete from equipment_categories where id >= 3;
\q
\d fcms
\q
\d scores
\d scores_details
\d courses
select count(*) from projects;
\d payments;
select projects.name from projects inner join payments on projects.id = payments.project_id;
select projects.name from projects inner join payments on projects.id = payments.project_id where payments.status = false;
select * from payments;
select projects.name from projects inner join payments on projects.id = payments.project_id where payments.status = false;
select projects.name, payments.id  from projects inner join payments on projects.id = payments.project_id where payments.status = false;
select projects.name from projects inner join payments on projects.id = payments.project_id where payments.status = false;
select projects.name,payments.id from projects inner join payments on projects.id = payments.project_id where payments.status = false;
select projects.name,payments.id from projects left join payments on projects.id = payments.project_id where payments.status = false;
select projects.name,payments.id from projects inner join payments on projects.id = payments.project_id where payments.status = false;
select projects.name,payments.id from projects inner join payments on projects.id = payments.project_id where payments.status = false;
select projects.name,payments.id from projects inner join payments on projects.id = payments.project_id where payments.status = false;
select project_id from payments where status = false;
select DISTINCT project_id from payments where status = false;
\d pricings
\q
\d projects
\d subcontracts
\d contracts
\d equipment
\d equipments
\q
\d homeworks
\q
\d teachings_courses
\d courses
\q
select * from institutions where name ilike '%alamo%';
select * from tutors where institution_id = 115;
\q
create database v3_oct_20 owner root
;
\q
select * from institutions where name ilike '%alamo%';
select * from tutors where institution_id = 115;
\q
select name from projects order by created desc;
select name from projects order by created desc;
delete projects;
delete from projects;
delete projects;
select name from projects order by created desc;
select name from projects order by created asc;
select name,status from projects order by created asc;
select name,status from projects order by created asc;
delete from projects;
delete from suppliers;
delete from suppliers;
delete from projects;
delete from projects;
delete from suppliers;
select name,status from projects order by created asc;
select name,status from projects order by created asc;
\d roles
select * from roles;
select name from roles;
delete from roles where id > 7;
select name from roles;
select name from roles;
\d users
select name from projects where name = "Nave Industrial Jilotepec"
;
\d contracts
\d projects;
select id from contracts order by created asc;
select id,created from contracts order by created asc;
delete from contracts where id > 25;
select count(*) from contracts where id > 25;
\d subcontracts
\d contracts
\q
create database southern_games with owner = root;
\q
\dt
\q
\q
\q
\d games
\q
select name from games;
select name from games;
select id,name from games;
\@
\q
\d project
\d projects
\d supplier
\d suppliers
select * from suppliers
;
\d suppliers
select * from suppliers
;
\d project
\d projects
\d project
\d projects
select * from projects;
\q
\d roles
\@
\q
create database aev4 with owner = root;
\q
\q
\d scores
select * from scores;
\d score_details
\q
\d homeworks
\d homeworks_students
select * from homeworks_students where homework_id = 2;
select * from homeworks_students where homework_id = 13;
select * from homeworks_students where homework_id = 13;
\q
\d scores
insert into scores (user_id, game_id, time, score) values (1,1,'00:01:25',0)
;
select * from scores;
\d scores;
\q
insert into scores (user_id, game_id, time, score) values (1,1,'00:01:25',0)
;
insert into scores (user_id, game_id, time, score,created,modified) values (1,1,'00:01:25',0,'2020-10-15','2020-10-15');
select * from scores;
\q
\q
\d scores;
\d monitories
\q
\d scores
\d monitories;
\q
select * from locales;
\q
select * from users;
\q
\d scores
\q
truncate table scores restart identity;
\q
\d payments
\@
\q
\q
\d tutors
\q
\d tutors
\q
\d teachings
sleect * from teachings;
select * from teachings;
\q
\d trivia_
\d trivia_questions
\d trivia_answers
\d trivia_answers
\q
select * from scores;
select * from scores where game_id = 4;
select * from scores where game_id = 3;
select * from usersM
;
select * from users;
\d scores
insert into scores user_id, game_id, time, score, created, modified values 5,3,05:00:00,100,2020-08-20,2020-08-20
;
insert into scores user_id, game_id, time, score, created, modified values 5,3,05:00:00,100,2020-08-20,2020-08-20;
insert into scores (user_id, game_id, time, score, created, modified) values (5,3,05:00:00,100,2020-08-20,2020-08-20);
insert into scores (user_id, game_id, time, score, created, modified) values (5,3,'05:00:00',100,'2020-08-20','2020-08-20');
insert into scores (user_id, game_id, time, score, created, modified) values (5,3,'05:00:00',100,'2020-08-20','2020-08-20');
insert into scores (user_id, game_id, time, score, created, modified) values (5,3,'05:00:00',100,'2020-08-20','2020-08-20');
insert into scores (user_id, game_id, time, score, created, modified) values (5,3,'05:00:00',100,'2020-08-20','2020-08-20');
insert into scores (user_id, game_id, time, score, created, modified) values (5,3,'05:00:00',100,'2020-08-20','2020-08-20');
insert into scores (user_id, game_id, time, score, created, modified) values (5,3,'05:00:00',100,'2020-08-20','2020-08-20');
insert into scores (user_id, game_id, time, score, created, modified) values (5,3,'05:00:00',100,'2020-08-20','2020-08-20');
insert into scores (user_id, game_id, time, score, created, modified) values (5,3,'05:00:00',100,'2020-08-20','2020-08-20');
insert into scores (user_id, game_id, time, score, created, modified) values (5,3,'05:00:00',100,'2020-08-20','2020-08-20');
insert into scores (user_id, game_id, time, score, created, modified) values (5,3,'05:00:00',100,'2020-08-20','2020-08-20');
insert into scores (user_id, game_id, time, score, created, modified) values (5,3,'05:00:00',100,'2020-08-20','2020-08-20');
\q
\d blogs
\q
\d blogs
\q
\d scores
\d score_details
\d score_details
\d scores
\q
\dt
\q
\dt
\d payments
\d institutions
\d payments
\q
\d institutions
\d messages
 \q
\d students
\q
\q
\d payments
\d institutions
\d students
\q
\d institutions
select * from institutions;
\d payments
\q
select * from payments;
\q
\d tutors
\d fcms
\q
delete from scores 
;
select * from scores;
delete from scores 
;
delete from scores 
;
delete from scores 
;
delete from scores 
;
\dt scores;
\d scores
;
insert into scores (user_id, game_id, time, score, created, modified) values (2,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00'
;
)
;
insert into scores (user_id, game_id, time, score, created, modified) values (2,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
delete from scores 
;
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
delete from scores where user_id != 3;
delete from scores where user_id != 3;
delete from scores where user_id != 3;
delete from scores where user_id != 3;
delete from scores where user_id != 3;
delete from scores where user_id != 3;
delete from scores where user_id != 3;
delete from scores where user_id != 3;
delete from scores where user_id != 3;
delete from scores where user_id != 3;
delete from scores where user_id != 3;
delete from scores where user_id != 3;
delete from scores ;
delete from scores ;
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
insert into scores (user_id, game_id, time, score, created, modified) values (3,2,'00:00:01',0,'2020-01-01 00:00:00','2020-01-01 00:00:00');
\q
\d payments
\d projects
\d payments
\q
select * from scores;
delete from scores;
select * from scores;
\ð scores;
\d scores;
delete from scores;
\q
select * from proyects;
select * from projects;
\q
\q
\d scores
insert into scores (user_id, game_id, time,score,created,modified) values (1,4,'00:02:00',0,'2020-02-02','2020-02-02');
select * from scores where game_id =4;
delete from scores where game_id = 4;
select * from scores where game_id =4;
insert into scores (user_id, game_id, time,score,created,modified) values (1,4,'00:02:00',0,'2020-02-02','2020-02-02');
insert into scores (user_id, game_id, time,score,created,modified) values (2,4,'00:02:00',0,'2020-02-02','2020-02-02');
\q
delete from scores where game_id = 4;
select * from scores where game_id = 4;
delete from scores where game_id = 4;
select * from scores where game_id = 4;
delete from scores where game_id = 4;
\d institutions
\d payments
\q
\d users
\d equipment_notifications:
\d equipment_notifications;
delete from payments;
delete from payments;
\q
delete from scores where game_id = 2;
delete from scores where game_id = 2;
delete from scores where game_id = 1;
\q
\s payments
