I am doing a project of my own and I'm trying to insert a bunch of entries into one of my fields. I wanted to create random values for emails, name, address, and phone number.
This is my entity that I created called Customer.
CREATE TABLE Customer
(
CustomerId Integer Primary Key,
Name varchar(255),
Address varchar(255),
PhoneNumber varchar(255),
Email varchar(255)
);
Then I used the random functions to create a bunch of random data, but the problem with random is that it creates only integers. Does anyone know how to do this but to add name, address, email, and phone number? Here is my code to create the random data.
INSERT INTO Customer (Name, Email, PhoneNumber, Address)
SELECT RANDOM(), RANDOM(), RANDOM(), RANDOM()
FROM (SELECT * FROM (
(SELECT 0 UNION ALL SELECT 1) t2,
(SELECT 0 UNION ALL SELECT 1) t4,
(SELECT 0 UNION ALL SELECT 1) t8,
(SELECT 0 UNION ALL SELECT 1) t16,
(SELECT 0 UNION ALL SELECT 1) t32,
(SELECT 0 UNION ALL SELECT 1) t64,
(SELECT 0 UNION ALL SELECT 1) t128,
(SELECT 0 UNION ALL SELECT 1) t256,
(SELECT 0 UNION ALL SELECT 1) t512,
(SELECT 0 UNION ALL SELECT 1) t1024,
(SELECT 0 UNION ALL SELECT 1) t2048
)
) LIMIT 55;
Aucun commentaire:
Enregistrer un commentaire