Skip to content

Commit 5e520d6

Browse files
authored
Update AUTO INCREMENT in SQL.txt
update file
1 parent 6ed5fc9 commit 5e520d6

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

AUTO INCREMENT in SQL.txt

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,25 @@ mysql> select * from staff;
1919
| s_id | name | number |
2020
+------+------+---------+
2121
| 1 | Hari | 4567890 |
22-
+------+------+---------+
22+
+------+------+---------+
23+
24+
// Auto Increament with a particular
25+
create table new(id int NOT NULL AUTO_INCREMENT PRIMARY KEY, name varchar(20));
26+
mysql> desc new;
27+
+-------+-------------+------+-----+---------+----------------+
28+
| Field | Type | Null | Key | Default | Extra |
29+
+-------+-------------+------+-----+---------+----------------+
30+
| id | int | NO | PRI | NULL | auto_increment |
31+
| name | varchar(20) | YES | | NULL | |
32+
+-------+-------------+------+-----+---------+----------------+
33+
34+
mysql> ALTER TABLE new AUTO_INCREMENT = 5;
35+
36+
mysql> INSERT INTO new(name) VALUES('Hari');
37+
mysql> select * from new
38+
-> ;
39+
+----+------+
40+
| id | name |
41+
+----+------+
42+
| 5 | Hari |
43+
+----+------+

0 commit comments

Comments
 (0)