1)DDL-CREATE, ALTER, DROP
DML-INSERT, UPDATE, DELETE
2)CREATE TABLE `users`(
`id` INT SIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(45) NOT NULL,
`email` VARCHAR(40) NOT NULL,
`b_day` DATE NOT NULL,
`gender` ENUM("male","female") DEFAULT "male"
PRIMARY KEY(`id`)
)ENGINE=INNODB DEFAULT CHARSET UTF8mb4;
CREATE TABLE `photos`(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`u_id` INT UNSIGNED NOT NULL,
`img_path` VARCHAR(255) NOT NULL,
PRIMARY KEY(`id`),
FOREIGN KEY(u_id) REFERENCES users(id)
ON DELETE CASCADE
ON UPDATE RESTRICT
)ENGINE=INNODB DEFAULT CHARSET UTF8mb4;
3)insert into `users`(`name`,`email`,`b-day`,`gender`) values
('Mike','mike@mail.ru','1980-10-10','0');
insert into `users`(`name`,`email`,`b-day`,`gender`) values
('Mike','mike@mail.ru','1980-10-10','0'),
('Bill','bill@mail.ru','1990-11-11','0');
UPDATE `users` SET `name` = 'Sem' where `name` = 'Bill';
DELETE FROM `users` where `name` = 'Sem';
4)CREATE TABLE `users2` LIKE `users`;
CREATE TABLE `users_clone` LIKE `users`;
INSERT INTO `users_clone` SELECT * FROM `users` GROUP BY ID;
5)CREATE VIEW `gender-stat` AS SELECT `gender` FROM `users`;