File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Index and view in a database. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Index and view in a database." Watch "Index and view in a database." New topic
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
    
    2

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
    
    2

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.
 
Similar Threads
database data -to-> List view, how
How to display variant number of record each page based on user's request ?
SQLException error: "Invalid Cursor position"
Optimizing an SQL Query
How to display variant number of record each page based on user's request ?