dimanche 31 janvier 2016

conflict that may occur when adding column to a table

Currently i have a database in android sqllite with many tables of the following column, column A and column B.

Now i am required to have table of column A , column B and column C for subsequent future table created in database. It is alright for me to keep old table of column A and B without changing anything.

so i have the following concern.

1 Let say i have the following code

rssiDB.execSQL("CREATE TABLE IF NOT EXISTS "  + rssiTableName + " (ssid VARCHAR, bssid VARCHAR , rssi INTEGER )" );

What is the meaning of if not exists. If i am trying to create a table with a table name that already exists but different number of column, will the creation of table be successful? What will happen actually.

for example i have this table of the table name testing20 with column value of a743954759 , -40

and now i want to create a table of the table name testing20 with column value of peterwifi,a7954759 , -60

will the above code create a table with the same name but different number of column.

2 In a database, is it allowed for database to have many table of different column or is it compulsory for database to have every table to have the exact number of column or column name.

Let say i have a database with one table of table name testing1 with column A and column B. can i now add a table with table name testing2 with column A, column B and column C to the database.

I know i can try this out to find out myself. However i am afraid that it will affect my existing table if i try it out. Hope someone can answer my question. Thank you

Aucun commentaire:

Enregistrer un commentaire