demo.sql 687 B

12345678910111213141516171819202122232425262728
  1. -- https://clickhouse.com/docs/zh/sql-reference/statements/drop
  2. -- #1 CREATE DATABASE
  3. CREATE DATABASE IF NOT EXISTS `dev-orm`;
  4. CREATE DATABASE `dev-orm-mysql` ENGINE = MySQL('10.123.27.170:3306', 'dev-orm', 'root', '123456');
  5. -- drop db
  6. DROP DATABASE IF EXISTS `dev-orm`;
  7. use `dev-orm`;
  8. -- #2 create table
  9. CREATE TABLE IF NOT EXISTS `User`
  10. (
  11. `id` Int32,
  12. `name` Nullable(String),
  13. `birth` Nullable(DateTime),
  14. `fatherId` Nullable(Int32),
  15. `motherId` Nullable(Int32)
  16. )
  17. ENGINE = MergeTree
  18. ORDER BY `id`;
  19. -- #3 insert
  20. insert into `User`(`id`,`name`,`birth`,`fatherId`,`motherId`) values(1,'u1',null,4,6);
  21. -- #4 delete
  22. ALTER TABLE `User` DELETE WHERE id in ( 7 ) ;