[SOLVED] Sql command to add 100 lines with same text in a collumn
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
If this is in regards to one of the Structured Query Language (SQL) databases, then INSERT is what you are looking for. However, the details vary per database. More information is needed.
Please write which database you have, including version, and which distro is it running on, including version.
Thanks. There are several ways to get that result.
What have you tried so far in regards to INSERT and a FOR or other loop there? Please show your formula so far so we can see what your approach is, where you are stuck, and what level of complexity you are thinking of.
It's not about finding, it's about learning and writing your own.
INSERT is only part of the solution. You still need a loop to count to 100. Either a FOR loop or a WHILE loop will do, though there are other methods which would work too.
Try looking closely at the two links in the previous post.
You created a table, but you have not inserted any data into it. Since you've been pointed to the pages showing you how to do an insert, can you not write a simple bash script that loops 100 times to perform this??
Code:
for i in {1..100}
do
<command>
done
Not harder than that...and this sounds suspiciously like homework.
For anyone that has not used Mariadb just typing in <command> is like for any old timer the cartoon that has an equation on the left and right in in the middle the saying "and then a miracle happens"...
From a practical standpoint a database table with a single column that contains the same data is useless since there is no way to "address" a single row. I assume this is why NevemTeve asked the question. So what you trying to accomplish?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.