Rob
Rob

Reputation: 275

Storage in SQLite Database

I am creating a teacher review Android Application.

As of now, I plan to create ~900 tables, each representing a professor. Each table entry will have a field for user comments on the teacher. Each time a user adds a comment, a new entry is added under that professor

Is this a logical way to go about this? I feel like there could be a more efficient way of doing this. Also, will having 900 tables be too much for MySQLite?

I was also thinking about having 1 table that will contain all the professors, and have the user comments as a field. Then, when every new comment is added I would somehow add 1 extra field. I don't think this uses databases properly, but is it possible (to +1 the number of fields)

Upvotes: 2

Views: 182

Answers (3)

Harald Wilhelm
Harald Wilhelm

Reputation: 6716

Without going into it to deep you will need at least one table for all professors, one table for all users and one table for the comments.

create table tbl_professor (id integer primary key, name text, ...)
create table tbl_user (id integer primary key, name text, ...)
create table tbl_comment (user_id integer, professor_id integer, thecomment text, ...)

Upvotes: 0

TWA
TWA

Reputation: 12816

I would recommend that you read a few articles on database design basics.

Here is a pretty good one that should get you started on the right track:

Fundamentals of Relational Database Design

Upvotes: 0

nicholas.hauschild
nicholas.hauschild

Reputation: 42849

You do not want 900 tables, you more than likely want one Teacher table with 900 entries. You may want to read up on some database design principles and the Relational Model. The most helpful part of the links may be the examples in the Relational Model.

Upvotes: 7

Related Questions