github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/snapshot/snapshot_restore_database_level.sql (about) 1 -- database level update/delete/insert 2 create database if not exists snapshot_read; 3 use snapshot_read; 4 create table test_snapshot_read (a int); 5 INSERT INTO test_snapshot_read (a) VALUES(1), (2), (3), (4), (5),(6), (7), (8), (9), (10), (11), (12),(13), (14), (15), (16), (17), (18), (19), (20),(21), (22), (23), (24), (25), (26), (27), (28), (29), (30),(31), (32), (33), (34), (35), (36), (37), (38), (39), (40),(41), (42), (43), (44), (45), (46), (47), (48), (49), (50),(51), (52), (53), (54), (55), (56), (57), (58), (59), (60),(61), (62), (63), (64), (65), (66), (67), (68), (69), (70),(71), (72), (73), (74), (75), (76), (77), (78), (79), (80), (81), (82), (83), (84), (85), (86), (87), (88), (89), (90),(91), (92), (93), (94), (95), (96), (97), (98), (99), (100); 6 CREATE TABLE users ( 7 id INT AUTO_INCREMENT PRIMARY KEY, 8 username VARCHAR(255) NOT NULL, 9 email VARCHAR(255) NOT NULL UNIQUE, 10 password VARCHAR(255) NOT NULL, 11 created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP 12 ); 13 INSERT INTO users (username, email, password) VALUES ('john_doe', 'john@example.com', 'securepassword123'); 14 INSERT INTO users (username, email, password) VALUES ('jane_smith', 'jane.smith@example.com', 'password123'),('alice_jones', 'alice.jones@gmail.com', 'ilovecats'),('bob_brown', 'bob.brown@yahoo.com', 'mysecretpassword'),('charlie_lee', 'charlie.lee@protonmail.ch', 'secure123'),('diana_wilson', 'diana.wilson@outlook.com', 'D1anaPass'); 15 INSERT INTO users (username, email, password) VALUES ('emily_adams', 'emily.adams@icloud.com', 'Em1Ly123'), ('francis_nguyen', 'francis.nguyen@domain.com', 'fNguyenPass'), ('grace_parker', 'grace.parker@server.com', 'G1race123'), ('henry_miller', 'henry.miller@company.org', 'hMillerSecret'), ('isabella_grant', 'isabella.grant@university.edu', 'iGrantPass'); 16 17 select count(*) from snapshot_read.test_snapshot_read; 18 select count(*) from snapshot_read.users; 19 20 create snapshot sp_01 for account sys; 21 delete from test_snapshot_read where a <= 50; 22 DELETE FROM users where email = 'john@example.com'; 23 UPDATE users SET password = 'newsecurepassword123' WHERE email = 'alice.jones@gmail.com'; 24 INSERT INTO test_snapshot_read (a) VALUES(1), (2), (3), (4), (5),(6), (7), (8), (9), (10), (11), (12),(13), (14), (15), (16), (17), (18), (19), (20),(21), (22), (23), (24), (25), (26), (27), (28), (29), (30),(31), (32), (33), (34), (35), (36), (37), (38), (39), (40); 25 select count(*) from snapshot_read.test_snapshot_read; 26 select count(*) from snapshot_read.users; 27 28 restore account sys database snapshot_read from snapshot sp_01; 29 select count(*) from snapshot_read.test_snapshot_read; 30 select count(*) from snapshot_read.users; 31 32 drop database snapshot_read; 33 drop snapshot sp_01; 34 35 -- database level drop table 36 create database if not exists snapshot_read; 37 use snapshot_read; 38 create table test_snapshot_read (a int); 39 INSERT INTO test_snapshot_read (a) VALUES(1), (2), (3), (4), (5),(6), (7), (8), (9), (10), (11), (12),(13), (14), (15), (16), (17), (18), (19), (20),(21), (22), (23), (24), (25), (26), (27), (28), (29), (30),(31), (32), (33), (34), (35), (36), (37), (38), (39), (40),(41), (42), (43), (44), (45), (46), (47), (48), (49), (50),(51), (52), (53), (54), (55), (56), (57), (58), (59), (60),(61), (62), (63), (64), (65), (66), (67), (68), (69), (70),(71), (72), (73), (74), (75), (76), (77), (78), (79), (80), (81), (82), (83), (84), (85), (86), (87), (88), (89), (90),(91), (92), (93), (94), (95), (96), (97), (98), (99), (100); 40 CREATE TABLE users ( 41 id INT AUTO_INCREMENT PRIMARY KEY, 42 username VARCHAR(255) NOT NULL, 43 email VARCHAR(255) NOT NULL UNIQUE, 44 password VARCHAR(255) NOT NULL, 45 created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP 46 ); 47 INSERT INTO users (username, email, password) VALUES ('john_doe', 'john@example.com', 'securepassword123'); 48 INSERT INTO users (username, email, password) VALUES ('jane_smith', 'jane.smith@example.com', 'password123'),('alice_jones', 'alice.jones@gmail.com', 'ilovecats'),('bob_brown', 'bob.brown@yahoo.com', 'mysecretpassword'),('charlie_lee', 'charlie.lee@protonmail.ch', 'secure123'),('diana_wilson', 'diana.wilson@outlook.com', 'D1anaPass'); 49 INSERT INTO users (username, email, password) VALUES ('emily_adams', 'emily.adams@icloud.com', 'Em1Ly123'), ('francis_nguyen', 'francis.nguyen@domain.com', 'fNguyenPass'), ('grace_parker', 'grace.parker@server.com', 'G1race123'), ('henry_miller', 'henry.miller@company.org', 'hMillerSecret'), ('isabella_grant', 'isabella.grant@university.edu', 'iGrantPass'); 50 51 select count(*) from snapshot_read.test_snapshot_read; 52 select count(*) from snapshot_read.users; 53 54 create snapshot sp_01 for account sys; 55 56 drop table users; 57 drop table test_snapshot_read; 58 59 select count(*) from snapshot_read.test_snapshot_read; 60 select count(*) from snapshot_read.users; 61 62 restore account sys database snapshot_read from snapshot sp_01; 63 64 select count(*) from snapshot_read.test_snapshot_read; 65 select count(*) from snapshot_read.users; 66 67 68 drop database snapshot_read; 69 drop snapshot sp_01; 70 71 72 -- database level drop database 73 create database if not exists snapshot_read; 74 use snapshot_read; 75 create table test_snapshot_read (a int); 76 INSERT INTO test_snapshot_read (a) VALUES(1), (2), (3), (4), (5),(6), (7), (8), (9), (10), (11), (12),(13), (14), (15), (16), (17), (18), (19), (20),(21), (22), (23), (24), (25), (26), (27), (28), (29), (30),(31), (32), (33), (34), (35), (36), (37), (38), (39), (40),(41), (42), (43), (44), (45), (46), (47), (48), (49), (50),(51), (52), (53), (54), (55), (56), (57), (58), (59), (60),(61), (62), (63), (64), (65), (66), (67), (68), (69), (70),(71), (72), (73), (74), (75), (76), (77), (78), (79), (80), (81), (82), (83), (84), (85), (86), (87), (88), (89), (90),(91), (92), (93), (94), (95), (96), (97), (98), (99), (100); 77 CREATE TABLE users ( 78 id INT AUTO_INCREMENT PRIMARY KEY, 79 username VARCHAR(255) NOT NULL, 80 email VARCHAR(255) NOT NULL UNIQUE, 81 password VARCHAR(255) NOT NULL, 82 created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP 83 ); 84 INSERT INTO users (username, email, password) VALUES ('john_doe', 'john@example.com', 'securepassword123'); 85 INSERT INTO users (username, email, password) VALUES ('jane_smith', 'jane.smith@example.com', 'password123'),('alice_jones', 'alice.jones@gmail.com', 'ilovecats'),('bob_brown', 'bob.brown@yahoo.com', 'mysecretpassword'),('charlie_lee', 'charlie.lee@protonmail.ch', 'secure123'),('diana_wilson', 'diana.wilson@outlook.com', 'D1anaPass'); 86 INSERT INTO users (username, email, password) VALUES ('emily_adams', 'emily.adams@icloud.com', 'Em1Ly123'), ('francis_nguyen', 'francis.nguyen@domain.com', 'fNguyenPass'), ('grace_parker', 'grace.parker@server.com', 'G1race123'), ('henry_miller', 'henry.miller@company.org', 'hMillerSecret'), ('isabella_grant', 'isabella.grant@university.edu', 'iGrantPass'); 87 88 89 select count(*) from snapshot_read.test_snapshot_read; 90 select count(*) from snapshot_read.users; 91 92 create snapshot sp_01 for account sys; 93 94 drop database snapshot_read; 95 96 select count(*) from snapshot_read.test_snapshot_read; 97 select count(*) from snapshot_read.users; 98 99 restore account sys database snapshot_read from snapshot sp_01; 100 101 select count(*) from snapshot_read.test_snapshot_read; 102 select count(*) from snapshot_read.users; 103 104 drop snapshot sp_01; 105 drop database if exists snapshot_read; 106 107 -- normal account 108 create account test_account admin_name = 'test_user' identified by '111'; 109 -- @session:id=2&user=test_account:test_user&password=111 110 -- database level update/delete/insert 111 create database if not exists snapshot_read; 112 use snapshot_read; 113 create table test_snapshot_read (a int); 114 INSERT INTO test_snapshot_read (a) VALUES(1), (2), (3), (4), (5),(6), (7), (8), (9), (10), (11), (12),(13), (14), (15), (16), (17), (18), (19), (20),(21), (22), (23), (24), (25), (26), (27), (28), (29), (30),(31), (32), (33), (34), (35), (36), (37), (38), (39), (40),(41), (42), (43), (44), (45), (46), (47), (48), (49), (50),(51), (52), (53), (54), (55), (56), (57), (58), (59), (60),(61), (62), (63), (64), (65), (66), (67), (68), (69), (70),(71), (72), (73), (74), (75), (76), (77), (78), (79), (80), (81), (82), (83), (84), (85), (86), (87), (88), (89), (90),(91), (92), (93), (94), (95), (96), (97), (98), (99), (100); 115 CREATE TABLE users ( 116 id INT AUTO_INCREMENT PRIMARY KEY, 117 username VARCHAR(255) NOT NULL, 118 email VARCHAR(255) NOT NULL UNIQUE, 119 password VARCHAR(255) NOT NULL, 120 created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP 121 ); 122 INSERT INTO users (username, email, password) VALUES ('john_doe', 'john@example.com', 'securepassword123'); 123 INSERT INTO users (username, email, password) VALUES ('jane_smith', 'jane.smith@example.com', 'password123'),('alice_jones', 'alice.jones@gmail.com', 'ilovecats'),('bob_brown', 'bob.brown@yahoo.com', 'mysecretpassword'),('charlie_lee', 'charlie.lee@protonmail.ch', 'secure123'),('diana_wilson', 'diana.wilson@outlook.com', 'D1anaPass'); 124 INSERT INTO users (username, email, password) VALUES ('emily_adams', 'emily.adams@icloud.com', 'Em1Ly123'), ('francis_nguyen', 'francis.nguyen@domain.com', 'fNguyenPass'), ('grace_parker', 'grace.parker@server.com', 'G1race123'), ('henry_miller', 'henry.miller@company.org', 'hMillerSecret'), ('isabella_grant', 'isabella.grant@university.edu', 'iGrantPass'); 125 126 select count(*) from snapshot_read.test_snapshot_read; 127 select count(*) from snapshot_read.users; 128 129 create snapshot sp_01 for account test_account; 130 delete from test_snapshot_read where a <= 50; 131 DELETE FROM users where email = 'john@example.com'; 132 UPDATE users SET password = 'newsecurepassword123' WHERE email = 'alice.jones@gmail.com'; 133 INSERT INTO test_snapshot_read (a) VALUES(1), (2), (3), (4), (5),(6), (7), (8), (9), (10), (11), (12),(13), (14), (15), (16), (17), (18), (19), (20),(21), (22), (23), (24), (25), (26), (27), (28), (29), (30),(31), (32), (33), (34), (35), (36), (37), (38), (39), (40); 134 select count(*) from snapshot_read.test_snapshot_read; 135 select count(*) from snapshot_read.users; 136 137 restore account test_account database snapshot_read from snapshot sp_01; 138 select count(*) from snapshot_read.test_snapshot_read; 139 select count(*) from snapshot_read.users; 140 141 drop database snapshot_read; 142 drop snapshot sp_01; 143 144 -- database level drop table 145 create database if not exists snapshot_read; 146 use snapshot_read; 147 create table test_snapshot_read (a int); 148 INSERT INTO test_snapshot_read (a) VALUES(1), (2), (3), (4), (5),(6), (7), (8), (9), (10), (11), (12),(13), (14), (15), (16), (17), (18), (19), (20),(21), (22), (23), (24), (25), (26), (27), (28), (29), (30),(31), (32), (33), (34), (35), (36), (37), (38), (39), (40),(41), (42), (43), (44), (45), (46), (47), (48), (49), (50),(51), (52), (53), (54), (55), (56), (57), (58), (59), (60),(61), (62), (63), (64), (65), (66), (67), (68), (69), (70),(71), (72), (73), (74), (75), (76), (77), (78), (79), (80), (81), (82), (83), (84), (85), (86), (87), (88), (89), (90),(91), (92), (93), (94), (95), (96), (97), (98), (99), (100); 149 CREATE TABLE users ( 150 id INT AUTO_INCREMENT PRIMARY KEY, 151 username VARCHAR(255) NOT NULL, 152 email VARCHAR(255) NOT NULL UNIQUE, 153 password VARCHAR(255) NOT NULL, 154 created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP 155 ); 156 INSERT INTO users (username, email, password) VALUES ('john_doe', 'john@example.com', 'securepassword123'); 157 INSERT INTO users (username, email, password) VALUES ('jane_smith', 'jane.smith@example.com', 'password123'),('alice_jones', 'alice.jones@gmail.com', 'ilovecats'),('bob_brown', 'bob.brown@yahoo.com', 'mysecretpassword'),('charlie_lee', 'charlie.lee@protonmail.ch', 'secure123'),('diana_wilson', 'diana.wilson@outlook.com', 'D1anaPass'); 158 INSERT INTO users (username, email, password) VALUES ('emily_adams', 'emily.adams@icloud.com', 'Em1Ly123'), ('francis_nguyen', 'francis.nguyen@domain.com', 'fNguyenPass'), ('grace_parker', 'grace.parker@server.com', 'G1race123'), ('henry_miller', 'henry.miller@company.org', 'hMillerSecret'), ('isabella_grant', 'isabella.grant@university.edu', 'iGrantPass'); 159 160 select count(*) from snapshot_read.test_snapshot_read; 161 select count(*) from snapshot_read.users; 162 163 create snapshot sp_01 for account test_account; 164 165 drop table users; 166 drop table test_snapshot_read; 167 168 select count(*) from snapshot_read.test_snapshot_read; 169 select count(*) from snapshot_read.users; 170 171 restore account test_account database snapshot_read from snapshot sp_01; 172 173 select count(*) from snapshot_read.test_snapshot_read; 174 select count(*) from snapshot_read.users; 175 176 177 drop database snapshot_read; 178 drop snapshot sp_01; 179 180 181 -- database level drop database 182 create database if not exists snapshot_read; 183 use snapshot_read; 184 create table test_snapshot_read (a int); 185 INSERT INTO test_snapshot_read (a) VALUES(1), (2), (3), (4), (5),(6), (7), (8), (9), (10), (11), (12),(13), (14), (15), (16), (17), (18), (19), (20),(21), (22), (23), (24), (25), (26), (27), (28), (29), (30),(31), (32), (33), (34), (35), (36), (37), (38), (39), (40),(41), (42), (43), (44), (45), (46), (47), (48), (49), (50),(51), (52), (53), (54), (55), (56), (57), (58), (59), (60),(61), (62), (63), (64), (65), (66), (67), (68), (69), (70),(71), (72), (73), (74), (75), (76), (77), (78), (79), (80), (81), (82), (83), (84), (85), (86), (87), (88), (89), (90),(91), (92), (93), (94), (95), (96), (97), (98), (99), (100); 186 CREATE TABLE users ( 187 id INT AUTO_INCREMENT PRIMARY KEY, 188 username VARCHAR(255) NOT NULL, 189 email VARCHAR(255) NOT NULL UNIQUE, 190 password VARCHAR(255) NOT NULL, 191 created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP 192 ); 193 INSERT INTO users (username, email, password) VALUES ('john_doe', 'john@example.com', 'securepassword123'); 194 INSERT INTO users (username, email, password) VALUES ('jane_smith', 'jane.smith@example.com', 'password123'),('alice_jones', 'alice.jones@gmail.com', 'ilovecats'),('bob_brown', 'bob.brown@yahoo.com', 'mysecretpassword'),('charlie_lee', 'charlie.lee@protonmail.ch', 'secure123'),('diana_wilson', 'diana.wilson@outlook.com', 'D1anaPass'); 195 INSERT INTO users (username, email, password) VALUES ('emily_adams', 'emily.adams@icloud.com', 'Em1Ly123'), ('francis_nguyen', 'francis.nguyen@domain.com', 'fNguyenPass'), ('grace_parker', 'grace.parker@server.com', 'G1race123'), ('henry_miller', 'henry.miller@company.org', 'hMillerSecret'), ('isabella_grant', 'isabella.grant@university.edu', 'iGrantPass'); 196 197 198 select count(*) from snapshot_read.test_snapshot_read; 199 select count(*) from snapshot_read.users; 200 201 create snapshot sp_01 for account test_account; 202 203 drop database snapshot_read; 204 205 select count(*) from snapshot_read.test_snapshot_read; 206 select count(*) from snapshot_read.users; 207 208 restore account test_account database snapshot_read from snapshot sp_01; 209 210 select count(*) from snapshot_read.test_snapshot_read; 211 212 drop snapshot sp_01; 213 drop database if exists snapshot_read; 214 -- @session 215 216 drop account test_account; 217 218 -- sys restore normal account 219 create account test_account admin_name = 'test_user' identified by '111'; 220 -- @session:id=3&user=test_account:test_user&password=111 221 create database if not exists snapshot_read; 222 use snapshot_read; 223 create table test_snapshot_read (a int); 224 insert into test_snapshot_read (a) values(1), (2), (3), (4), (5),(6), (7), (8), (9), (10), (11), (12),(13), (14), (15), (16), (17), (18), (19), (20),(21), (22), (23), (24), (25), (26), (27), (28), (29), (30),(31), (32), (33), (34), (35), (36), (37), (38), (39), (40),(41), (42), (43), (44), (45), (46), (47), (48), (49), (50),(51), (52), (53), (54), (55), (56), (57), (58), (59), (60),(61), (62), (63), (64), (65), (66), (67), (68), (69), (70),(71), (72), (73), (74), (75), (76), (77), (78), (79), (80), (81), (82), (83), (84), (85), (86), (87), (88), (89), (90),(91), (92), (93), (94), (95), (96), (97), (98), (99), (100); 225 select count(*) from snapshot_read.test_snapshot_read; 226 227 CREATE TABLE users ( 228 id INT AUTO_INCREMENT PRIMARY KEY, 229 username VARCHAR(255) NOT NULL, 230 email VARCHAR(255) NOT NULL UNIQUE, 231 password VARCHAR(255) NOT NULL, 232 created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP 233 ); 234 INSERT INTO users (username, email, password) VALUES ('john_doe', 'john@example.com', 'securepassword123'); 235 INSERT INTO users (username, email, password) VALUES ('jane_smith', 'jane.smith@example.com', 'password123'),('alice_jones', 'alice.jones@gmail.com', 'ilovecats'),('bob_brown', 'bob.brown@yahoo.com', 'mysecretpassword'),('charlie_lee', 'charlie.lee@protonmail.ch', 'secure123'),('diana_wilson', 'diana.wilson@outlook.com', 'D1anaPass'); 236 INSERT INTO users (username, email, password) VALUES ('emily_adams', 'emily.adams@icloud.com', 'Em1Ly123'), ('francis_nguyen', 'francis.nguyen@domain.com', 'fNguyenPass'), ('grace_parker', 'grace.parker@server.com', 'G1race123'), ('henry_miller', 'henry.miller@company.org', 'hMillerSecret'), ('isabella_grant', 'isabella.grant@university.edu', 'iGrantPass'); 237 238 select count(*) from snapshot_read.users; 239 240 CREATE TABLE students ( 241 student_id INT PRIMARY KEY AUTO_INCREMENT, 242 name VARCHAR(100) NOT NULL, 243 age INT NOT NULL 244 ); 245 246 INSERT INTO students (name, age) VALUES ('Alice', 20), ('Bob', 21), ('Charlie', 22), ('Diana', 23), ('Emily', 24); 247 INSERT INTO students (name, age) VALUES ('Francis', 25), ('Grace', 26), ('Henry', 27), ('Isabella', 28), ('Jack', 29); 248 INSERT INTO students (name, age) VALUES ('Katherine', 30), ('Liam', 31), ('Mia', 32), ('Noah', 33), ('Olivia', 34); 249 INSERT INTO students (name, age) VALUES ('Penelope', 35), ('Quinn', 36), ('Ryan', 37), ('Sophia', 38), ('Thomas', 39); 250 INSERT INTO students (name, age) VALUES ('Ursula', 40), ('Victor', 41), ('Wendy', 42), ('Xander', 43), ('Yvonne', 44); 251 INSERT INTO students (name, age) VALUES ('Zachary', 45), ('Ava', 46), ('Benjamin', 47), ('Charlotte', 48), ('Daniel', 49); 252 INSERT INTO students (name, age) VALUES ('Ella', 50), ('Finn', 51), ('Gabriella', 52), ('Henry', 53), ('Isabella', 54); 253 INSERT INTO students (name, age) VALUES ('Jack', 55), ('Katherine', 56), ('Liam', 57), ('Mia', 58), ('Noah', 59); 254 INSERT INTO students (name, age) VALUES ('Olivia', 60), ('Penelope', 61), ('Quinn', 62), ('Ryan', 63), ('Sophia', 64); 255 INSERT INTO students (name, age) VALUES ('Thomas', 65), ('Ursula', 66), ('Victor', 67), ('Wendy', 68), ('Xander', 69); 256 257 select count(*) from snapshot_read.students; 258 -- @session 259 260 create snapshot sp_01 for account test_account; 261 262 -- @session:id=4&user=test_account:test_user&password=111 263 use snapshot_read; 264 drop table students; 265 drop table users; 266 -- @session 267 268 restore account test_account database snapshot_read from snapshot sp_01; 269 270 -- @session:id=5&user=test_account:test_user&password=111 271 select count(*) from snapshot_read.students; 272 select count(*) from snapshot_read.users; 273 -- @session 274 275 276 -- @session:id=6&user=test_account:test_user&password=111 277 drop database snapshot_read; 278 -- @session 279 280 restore account test_account database snapshot_read from snapshot sp_01; 281 282 -- @session:id=7&user=test_account:test_user&password=111 283 select count(*) from snapshot_read.students; 284 select count(*) from snapshot_read.users; 285 -- @session 286 287 drop snapshot sp_01; 288 drop account test_account; 289 290 291 create account test_account admin_name = 'test_user' identified by '111'; 292 -- @session:id=8&user=test_account:test_user&password=111 293 create database if not exists snapshot_read; 294 use snapshot_read; 295 create table test_snapshot_read (a int); 296 insert into test_snapshot_read (a) values(1), (2), (3), (4), (5),(6), (7), (8), (9), (10), (11), (12),(13), (14), (15), (16), (17), (18), (19), (20),(21), (22), (23), (24), (25), (26), (27), (28), (29), (30),(31), (32), (33), (34), (35), (36), (37), (38), (39), (40),(41), (42), (43), (44), (45), (46), (47), (48), (49), (50),(51), (52), (53), (54), (55), (56), (57), (58), (59), (60),(61), (62), (63), (64), (65), (66), (67), (68), (69), (70),(71), (72), (73), (74), (75), (76), (77), (78), (79), (80), (81), (82), (83), (84), (85), (86), (87), (88), (89), (90),(91), (92), (93), (94), (95), (96), (97), (98), (99), (100); 297 select count(*) from snapshot_read.test_snapshot_read; 298 299 CREATE TABLE users ( 300 id INT AUTO_INCREMENT PRIMARY KEY, 301 username VARCHAR(255) NOT NULL, 302 email VARCHAR(255) NOT NULL UNIQUE, 303 password VARCHAR(255) NOT NULL, 304 created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP 305 ); 306 INSERT INTO users (username, email, password) VALUES ('john_doe', 'john@example.com', 'securepassword123'); 307 INSERT INTO users (username, email, password) VALUES ('jane_smith', 'jane.smith@example.com', 'password123'),('alice_jones', 'alice.jones@gmail.com', 'ilovecats'),('bob_brown', 'bob.brown@yahoo.com', 'mysecretpassword'),('charlie_lee', 'charlie.lee@protonmail.ch', 'secure123'),('diana_wilson', 'diana.wilson@outlook.com', 'D1anaPass'); 308 INSERT INTO users (username, email, password) VALUES ('emily_adams', 'emily.adams@icloud.com', 'Em1Ly123'), ('francis_nguyen', 'francis.nguyen@domain.com', 'fNguyenPass'), ('grace_parker', 'grace.parker@server.com', 'G1race123'), ('henry_miller', 'henry.miller@company.org', 'hMillerSecret'), ('isabella_grant', 'isabella.grant@university.edu', 'iGrantPass'); 309 310 select count(*) from snapshot_read.users; 311 312 CREATE TABLE students ( 313 student_id INT PRIMARY KEY AUTO_INCREMENT, 314 name VARCHAR(100) NOT NULL, 315 age INT NOT NULL 316 ); 317 318 INSERT INTO students (name, age) VALUES ('Alice', 20), ('Bob', 21), ('Charlie', 22), ('Diana', 23), ('Emily', 24); 319 INSERT INTO students (name, age) VALUES ('Francis', 25), ('Grace', 26), ('Henry', 27), ('Isabella', 28), ('Jack', 29); 320 INSERT INTO students (name, age) VALUES ('Katherine', 30), ('Liam', 31), ('Mia', 32), ('Noah', 33), ('Olivia', 34); 321 INSERT INTO students (name, age) VALUES ('Penelope', 35), ('Quinn', 36), ('Ryan', 37), ('Sophia', 38), ('Thomas', 39); 322 INSERT INTO students (name, age) VALUES ('Ursula', 40), ('Victor', 41), ('Wendy', 42), ('Xander', 43), ('Yvonne', 44); 323 INSERT INTO students (name, age) VALUES ('Zachary', 45), ('Ava', 46), ('Benjamin', 47), ('Charlotte', 48), ('Daniel', 49); 324 INSERT INTO students (name, age) VALUES ('Ella', 50), ('Finn', 51), ('Gabriella', 52), ('Henry', 53), ('Isabella', 54); 325 INSERT INTO students (name, age) VALUES ('Jack', 55), ('Katherine', 56), ('Liam', 57), ('Mia', 58), ('Noah', 59); 326 INSERT INTO students (name, age) VALUES ('Olivia', 60), ('Penelope', 61), ('Quinn', 62), ('Ryan', 63), ('Sophia', 64); 327 INSERT INTO students (name, age) VALUES ('Thomas', 65), ('Ursula', 66), ('Victor', 67), ('Wendy', 68), ('Xander', 69); 328 329 select count(*) from snapshot_read.students; 330 -- @session 331 332 create snapshot sp_01 for account test_account; 333 334 335 create account test_account_2 admin_name = 'test_user_2' identified by '111'; 336 restore account test_account database snapshot_read from snapshot sp_01 to account test_account_2; 337 338 -- @session:id=9&user=test_account_2:test_user_2&password=111 339 select count(*) from snapshot_read.students; 340 select count(*) from snapshot_read.users; 341 -- @session 342 343 drop snapshot sp_01; 344 drop account test_account; 345 drop account test_account_2;