Skip to content

Instantly share code, notes, and snippets.

View rafaelor20's full-sized avatar

Rafael Oliveira Rosário rafaelor20

View GitHub Profile
@rafaelor20
rafaelor20 / main.py
Created June 27, 2023 21:41
Python script which shows cpu and memory usage
import psutil
import time
import os
#To execute:
#DISPLAY=:0 python3 main.py
def clearScreen():
# Clear screen using ANSI escape sequences
if os.name == 'nt': # For Windows
@rafaelor20
rafaelor20 / Locadora-de-DVDs.sql
Created February 27, 2023 23:48
Prática SQL: Locadora de DVDs
--link: https://drive.google.com/file/d/1oL_6TLdZuicRCsJZDSRuzoUv9SQxajoa/view?usp=share_link
CREATE TABLE states (
id serial primary key,
name varchar(30) NOT NULL unique
);
CREATE TABLE cities (
id serial primary key,
name varchar(30)NOT NULL,
--Link da imagem: https://drive.google.com/file/d/1LY0psjja8-rJLvkZxBpHaJUVbdVUVm75/view?usp=share_link
CREATE TABLE students (
id serial primary key,
"classId" serial REFERENCES classes(id),
name varchar(30) NOT NULL,
cpf varchar(30) NOT NULL unique,
email varchar(30) NOT NULL unique
)
--Link do print: https://drive.google.com/file/d/1rap2YssIh1eQv1bLjsAMkAy3MytPaAeJ/view?usp=sharing
CREATE TABLE states (
id int primary key,
name varchar(30) NOT NULL unique
);
CREATE TABLE cities (
id int primary key,
CREATE TABLE states (
id int primary key,
name varchar(30) NOT NULL unique
);
CREATE TABLE cities (
id int primary key,
name varchar(30)NOT NULL,
stateId int foreign key references states(id) NOT NULL
);
SELECT COUNT(*) FROM experiences WHERE "endDate" IS NOT NULL;
SELECT "userId" AS id, COUNT("userId") AS educations FROM educations GROUP BY "userId" ORDER BY "userId";
SELECT name as writer FROM users WHERE id = 465; SELECT COUNT("writerId") AS testimonials FROM testimonials WHERE "writerId" = 465;