How to generate a database table from a .csv file automatically? [closed] - database

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have a CSV file with 110 columns.
Preparing a table with 110 columns manually will take me forever. Is there any other way to do it?
I tried to create a table , but I was wondering if there is any way that when I create a table in putty session, it takes the column names and number of columns by itself.

Before you jump the gun and just make one huge table, you should sit down and think about if having one massive table really is useful in the long run. Normalization can be a wonderful thing, and depending on the size of your input it would be much less of a hassle to structure everything now rather then later.
As far as deciding what to import, toss it into excel or mysql and drop the fields you don't want/need. Mysql will actually build the structure of your table from the csv file, as long as you give it the right delimiter (comma, semicolon, whatever seperates your fields).

Related

Store large text array data in PostgreSQL database [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 days ago.
Improve this question
I have this requirement where I need to dump a large array of user Ids in one of the columns of a table in PostgreSQL DB. Let's say the max number of user Ids would be 100,000 and each user Id is of max 50 characters length. I won't be performing any operations on that table, it is just for logging purpose.
I've used text[] type column to dump those array of user Ids. I don't know if its the best way to do. I'm worried that some "max size limit reached" error gets thrown if the length of the array increases in the future.
Please suggest a better way to achieve this :)

How to generate unique ids in C [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am developing an app which requires to generate an id for new users I want to do it with the smallest number of characters that allows me to create 100 billion diferent possible ids so how should I do that and how to avoid giving two users the same it? Should I look if that id exists? Should I use a random id generator or give ids in order like 001 002 and so on?
This depends entirely on what kind of functionality you expect from this id, do you intend for these id's to correlate with persisted data, such as a database? If this is the case, it might be more prudent to let the database handle the unique ID generation for you. Otherwise, using sequential values such as 1,2,3... etc would probably be ideal. unsigned long will keep you covered for the first 2 billion users... If you somehow go beyond that, you can rethink your data storage then.
The question is very broad.

using`varchar` and `nvarchar` columns in the same table and database? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Are there any possible implications if I have varchar and nvarchar columns in the same table or database?
--Additional Details--
I have a database with 'varchar' and now I want to convert everything to unicode data types nvarchar. But someone from the team suggested that we shouldn't touch a specific column because anyway it will take only varchar characters e.g. the inherited collation. Now, is there a case we can get any problems in future if we adopt his suggestion? We are not going to compare the varchar column with a nvarchar.
No, feel free to have one of the types, both of them or neither.
Just remember that if you want to store unicode, or think that in any time in the future you'll store unicode - choose nvarchar. It takes more space for each character, but it usually doesn't really matter (and when it does, if you enable compression on the table there is also a unicode compression that helps reduce the space).

How to update data in database without using several queries? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
In my application, it shows student's subject and it's result. First, I have written this application to show the subject and results only. But, now we need to extend it's functionality to update subjects results from admin panel.
Problem is in my database, I have recorded results, if the student has taken-part in the given subject. As an example if a student is absent for mathematics, in the application subject will be printed without results for mathematics.
What I need is to update the results for each student. What I have noticed was, I need to write update, insert and delete queries to update student's results.
I don't want to handle 3 queries. I am looking for more flexible way of doing this.
One solution, I came across is, update database manually. That is if the student is absent for any given subject, update results to 0 and keep the record. so in admin panel, I need to use only update query.I am not sure where this is ok from database concepts.
Is there any better solutions?
I didn't understand your question... may be this will be useful check this one
$var=1;
update tablename set col=col+$var
you can directly add value without retrieving previous value.

Database Design for similar data across multiple time [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am attempting to come up with a Database Design that works well for a specific division of my company.
Basically, I have a list of Account Numbers with a ton of fields associated with them. My division needs to compare how these fields change over time (What was in that field for this account number a year ago?).
I am currently thinking of a very linear approach where I use only one large table for the data that is time stamped so a table would have the name AccountInfo04012013 and then the next month would be a new table called AccountInfo05012013. This way we can make comparisons between any two months.
What are the drawbacks of this plan? and what should I be doing instead?
You are going to have to use timestamps. All database managers will have this built in.

Resources