• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Index and view in a database.

 
Rd Dari
Ranch Hand
Posts: 212
Java Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 3747
62
Chrome Netbeans IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 212
Java Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 3747
62
Chrome Netbeans IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 466
1
IntelliJ IDE Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rd Dari
Ranch Hand
Posts: 212
Java Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all of you for a good and soon reply !

I really appreciate this Forum site.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic