+ 2

I need help with SQL query to insert a record multiple times at once. Like if I want to insert 'Ani' 100× in a field call 'Name'

SQL

7th Jun 2019, 10:16 PM
Prince Ani Frimpong
Prince Ani Frimpong - avatar
2 Respuestas
+ 11
INSERT statements that use VALUES syntax can insert multiple rows. To do this, include multiple lists of column values, each enclosed within parentheses and separated by commas. For example :- INSERT INTO tbl_name (Name) VALUES ('Ani'), ('Ani'), ('Ani');
8th Jun 2019, 9:04 PM
A͢J
A͢J - avatar
0
If it was to add a column with default 'Ani' as value, use ALTER TABLE: ALTER TABLE table_name ADD column_name varchar(100) default 'Ani' If it was to update rows in a column, use UPDATE UPDATE table_name SET column_name='Ani' Additionally, add WHERE condition to update only selected rows with specific value, otherwise, all records in the column_name will be filled with 'Ani': WHERE other_column='Sololearner'
8th Jun 2019, 1:33 PM
Ed Briones
Ed Briones - avatar