- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a view on table TAB1 for column Name, age, enrollmentId & age > 10 years. >
A view is an alternative way of representing the data stored in a table. A view can be used to increase the performance of the query since the view contains very limited rows as compared to its source table. We can use the below command to create a view on an existing table TAB1.
CREATE VIEW AGEVIEW (NAME, AGE, ENROLLMENT_ID) AS SELECT NAME, AGE, ENROLLMENT_ID FROM TAB1 WHERE AGE > 10;
We have to use CREATE VIEW reserved words in order to create a new view. This will be followed by the name of the view (AGEVIEW).
The columns which are needed in the view are included in parentheses and these columns are also part of the SELECT SQL statement.
The WHERE clause of the SELECT SQL statement gives the condition which has to be included in a view. In this case, we have added a condition for age greater than 10 years.
- Related Articles
- How to create a DB2 table TAB1 with 4 columns, Student ID, Enrollment ID, Name and Age?
- Present age of father is 42 years and that of his son is 14 years. Find the ratio of(a) Present age of father to the present age of son.(b) Age of the father to the age of son, when son was 12 years old.(c) Age of father after 10 years to the age of son after 10 years.(d) Age of farher to the age of son when father was 30 years old.
- The product of Ramu’s age (in years) five years ago and his age (in years) nine years later is 15. Determine Ramu’s present age.
- My present age is 15 years. My age 4 years ago was?
- The product of Shikha’s age five years ago and her age 8 years later is 30, her age at both times being given in years. Find her present age.
- The present age of a father is three years more than three times the age of the son. Three years hence father’s age will be 10 years more than twice the age of the son. Determine their present ages.
- Before 2 years, Uma's age was ( x ) years. After 2 years, her age will be _______ years.
- The present age of Ekraj is 45 years and his son's age is 20 years. Find the ratio of their age after 5 years.
- How will you add a constraint on above DB2 table TAB1 for ages between 3 to 16 years?
- How to add a unique index on the above table TAB1 for column Enrollment ID (ascending)?
- How to create an ALIAS TAB2 for DB2 table TAB1?
- 6 years later Ravi's age is 25 years, then the present age of Ravi is?
- After 15 years Mohan's age will be four times his present age. Find the present age.
- How to create a table TAB2 having same attributes & columns as for table TAB1
- How to calculate age in years from birthdate in MySQL?