- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
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 can we create MySQL views without any column list?
While creating a view, providing the list of columns is optional. The following example will illustrate by creating the views without any column list −
mysql> Select * from student_detail; +-----------+-------------+------------+ | Studentid | StudentName | address | +-----------+-------------+------------+ | 100 | Gaurav | Delhi | | 101 | Raman | Shimla | | 103 | Rahul | Jaipur | | 104 | Ram | Chandigarh | | 105 | Mohan | Chandigarh | +-----------+-------------+------------+ 5 rows in set (0.17 sec) mysql> Create view View_student_detail AS SELECT * FROM Student_Detail; Query OK, 0 rows affected (0.17 sec)
As we can notice in the query below that while creating the view we have not given any column names and that is why it is the view without column list. Now, if we will run the query using the name of the view then we will get all the columns from the table on which it is created.
mysql> Select * from View_student_detail; +-----------+-------------+------------+ | Studentid | StudentName | address | +-----------+-------------+------------+ | 100 | Gaurav | Delhi | | 101 | Raman | Shimla | | 103 | Rahul | Jaipur | | 104 | Ram | Chandigarh | | 105 | Mohan | Chandigarh | +-----------+-------------+------------+ 5 rows in set (0.00 sec)
- Related Articles
- How can we create MySQL views with column list?
- How can we create MySQL views?
- How can we see the list of views stored in a particular MySQL database?
- How can we create MySQL stored procedures without ‘BEGIN’ and ‘END’?
- How can we use logical operators while creating MySQL views?
- Can we insert values without mentioning the column name in MySQL?
- Where MySQL views can be inconsistent and how can we ensure their consistency?
- How can we use a combination of logical operators while creating MySQL views?
- How to get a list of MySQL views?
- How can we use MySQL SELECT without FROM clause?
- How can we fetch a MySQL SET column as a list of integer offset?
- How can we emulate CHECK CONSTRAINT by using views?
- Can we write an interface without any methods in java?
- How can we run a MySQL statement without termination semicolon?
- How can we modify column/s of MySQL table?

Advertisements