| Author |
Index and view in a database.
|
Rd Dari
Ranch Hand
Joined: Feb 22, 2010
Posts: 194
|
|
Hi all,
Please clear that , there is a base table named A consists 10 records , then how many records in a view. And if I delete a record from table then in the view how many records will be.
Thanks!!
|
 |
Martin Vajsar
Bartender
Joined: Aug 22, 2010
Posts: 2328
|
|
It depends on the definition of the view, of course.
View in a relational database is just a stored SQL query that is executed against the table(s) whenever the view is used.
Index is yet another thing. Generally, indexes should not affect results of SQL databases; they are there to speed up some SQL queries or to enforce database constraints.
|
 |
Rd Dari
Ranch Hand
Joined: Feb 22, 2010
Posts: 194
|
|
OK
one more question is that if I drop table A then index and view will be drop or not?
Thanks for your reply!
|
 |
Martin Vajsar
Bartender
Joined: Aug 22, 2010
Posts: 2328
|
|
|
It might differ depending on the database, but generally indexes are dropped when the table is dropped. Views are usually kept in an invalid state, they are unusable until fixed.
|
 |
Vinod Tiwari
Ranch Hand
Joined: Feb 06, 2008
Posts: 458
|
|
|
Like Martin rightly pointed its database specific like in Oracle if you drop table view and indexes both would be dropped but in DB2 if you drop table then views on the table are marked inoperative and indexes are dropped.
|
Vinod Tiwari | Twitter
|
 |
Rd Dari
Ranch Hand
Joined: Feb 22, 2010
Posts: 194
|
|
Thanks all of you for a good and soon reply !
I really appreciate this Forum site.
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: Index and view in a database.
|
|
|