Skip to content
braincrash edited this page Apr 28, 2014 · 12 revisions

Queries

Get Organization from email:
SELECT DISTINCT
    organization.name
FROM 
    organization
INNER 
    JOIN shoe
    ON shoe.organizationid=organization.id
INNER 
    JOIN donors
    ON donors.id=shoe.donorsid
WHERE
    donors.email = '[email protected]';
Create Donor with Shoe:
INSERT INTO shoe (donorsid,img,gender,size,type,received_date) 
VALUES ((SELECT id FROM donors WHERE email = '[email protected]'),'SDFSDassasDFASDF','F','33','sandalia',NOW())
Create Donor:
INSERT INTO donors (name,email,phone)
VALUES ('John Doe','[email protected]','987654321')
Create Shoe:
INSERT INTO shoe (donorsid,img,gender,size,type,received_date)
VALUES (3,'WQRQREQWRRWRQWR','M','42','sandalia',NOW())
Create Organization:
INSERT INTO organization (name,phone,email,website,address,city,country)
VALUES ('Danoninho','987654321','[email protected]','http://www.danonas.com','Rua das Belas Couves Nº1','Lisboa','Portugal')
Update Donor
Update Shoe
Update Organization
Delete Donor
Delete Shoe
Delete Organization
Clean Index(auto-increment)
ALTER TABLE tablename AUTO_INCREMENT = 0;