

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 Questions & Answers
- How to create a DB2 table TAB1 with 4 columns, Student ID, Enrollment ID, Name and Age?
- How to calculate age in years from birthdate in MySQL?
- How will you add a constraint on above DB2 table TAB1 for ages between 3 to 16 years?
- How to create an ALIAS TAB2 for DB2 table TAB1?
- How to add a unique index on the above table TAB1 for column Enrollment ID (ascending)?
- C program to calculate age
- How to create a table TAB2 having same attributes & columns as for table TAB1
- How can we find the employees from MySQL table whose age is greater than say 30 years, providing the only date of birth on the table?
- How to look younger than your age?
- Playtime Guide – Age appropriate toys for babies?
- Can I get Age using BirthDate column in a MySQL query?
- Calculate age based on date of birth in MySQL?
- How to get age from DOB in MySQL?
- What is the maximum age for male and female to have healthy kids?
- How to delete a DB2 table TAB1?
Advertisements