Additional SQL Server features and topics not covered by specific categories
Note a table is an unordered set of rows. If result set ordering is required, you need an ORDER BY clauses.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am trying to insert multiple data at once in the id column of the table below but found out that the data in the id column is not inserted in ascending form . please correct me why
```sql
CREATE TABLE sub_group (
id INT IDENTITY(1,1) PRIMARY KEY,
sub_group_name VARCHAR(255) NOT NULL UNIQUE
);
INSERT INTO sub_group (sub_group_name) VALUES
('Sundry Creditors'),
('Sundry Debtors'),
('Provision'),
('Cash in hand'),
('Duties & Taxes'),
('Deposit(asset)'),
('Bank Accounts'),
('Loans & Advance (Assets)'),
('Bank OD & OCC Account'),
('Secured Loans'),
('Unsecured Loans'),
('Stock in hand'),
('Reserves & Surplus');
select * from sub_group
this is the result i got
id sub_group_name
7 Bank Accounts
9 Bank OD & OCC Account
4 Cash in hand
6 Deposit(asset)
5 Duties & Taxes
8 Loans & Advance (Assets)
3 Provision
13 Reserves & Surplus
10 Secured Loans
12 Stock in hand
1 Sundry Creditors
2 Sundry Debtors
11 Unsecured Loans
Additional SQL Server features and topics not covered by specific categories
Note a table is an unordered set of rows. If result set ordering is required, you need an ORDER BY clauses.
If you look into the ID created, and compare your insert query order, it is created in the correct order. In your select query, the data is retrieved in the order of sub group name. Try execute the query to select the data in the order of id.
select * from sub_group order by id
Hope this helps.