Skip to content
Modeller & data-design

User ID

Antingen en vanlig primary key med INT-nummer:
1 ,2 ,3 ,4 5, 6, n ... etc

UUID (universally unique identifier)
bild.png
Ex: i MySQL:

SELECT UUID()
AS
UUID_VALUE1,
UUID()
AS UUID_VALUE2,
UUID()
AS UUID_VALUE3 ;

Ex skapa table med UUID:
CREATE TABLE OrderDetails(
OrderId BINARY(16) PRIMARY KEY,
ProductName VARCHAR(100) NOT NULL,
Price DECIMAL(10, 2) NOT NULL,
ExpectedDelivery DATE NOT NULL
);

INSERT INTO OrderDetails(OrderId, ProductName, Price, ExpectedDelivery)
VALUES(UUID_TO_BIN(UUID()), 'Asus Rog', 90000.00, '2020-12-20'),
(UUID_TO_BIN(UUID()), 'Acer Predator', 100000.00, '2020-12-18'),
(UUID_TO_BIN(UUID()), 'Lenovo Legion', 85000.00, '2020-12-19'),
(UUID_TO_BIN(UUID()), 'Hp Omen', 70000.00, '2020-12-18'),
(UUID_TO_BIN(UUID()), 'Dell Inspiron', 65000.00, '2020-12-23'),
(UUID_TO_BIN(UUID()), 'Acer Nitro', 60000.00, '2020-12-22'),
(UUID_TO_BIN(UUID()), 'Asus Tuf', 80000.00, '2020-12-19');
Träna på att förstå exempel:
GUID (Microsofts UUID-version)
Globalt unikt ID
bild.png
bild.png

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.