Skip to main content

Views in SQL a sample Query for your project

A view is basically a logical view of one or more base tables. A view can be a read only or updatable. A view generally be created to avoid any unwanted changes into actual base tables. Mainly view is created for security reasons.
  • A view can be constructed with another view so it is called as nested view.
  • You can create or replace an existing view
  • A view can be created without having base tables. This is possible with FORCE option.
Learn SQL and handle databases confidently
Learn SQL and handle databases confidently
Read only views: The standard syntax for view is as follows:

CREATE OR REPLACE VIEW INVOICE_SUMMARY AS
SELECT VENDOR_NAME
COUNT(*) AS INVOICE_COUNT,
SUM(INVOICE_TOTAL) AS INVOICE_TOTAL_SUM
FROM VENDORS
JOIN INVOICES ON VENDORS.VENDOR_ID*INVOICES.VENDOR_ID
GROUP BY VENDOR_NAME;

How to use FORCE command:

CREATE FORCE VIEW PRODUCTS_LIST AS
SELECT PRODUCT_DESCRIPTION, PRODUCT_PRICE
FROM PRODUCTS;

Updatable Views: A view can also be updatable if a view follows certain rules. Read more to understand all about what is updatable view.  
  • A view when it is created for update purpose, you can give INSERT,UPDATE and DELETE
  • A read only view should contain WITH READ ONLY CLAUSE.
While updating a view, it is possible to update only one base table at a time. When you created a view from more than one table, then it is not possible to update two tables at a time.

What is ALTER view
This is possible with CREATE OR REPLACE statement. Just you can replace with existing statement.

Drop view
DROP VIEW VENDORS_SW


Last pointsA view with CHECK OPTION is surely help you to satisfy certain condition. Usually this option will be used in updatable views.

Comments

Popular posts from this blog

Four Tableau products a quick review and explanation

I want to share you what are the Products most popular.

Total four products. Read the details below.

Tableau desktop-(Business analytics anyone can use) - Tableau  Desktop  is  based  on  breakthrough technology  from  Stanford  University  that  lets  you drag & drop to analyze data. You can connect to  data in a few clicks, then visualize and create interactive dashboards with a few more.

We’ve done years of research to build a system that supports people’s natural  ability  to  think visually. Shift fluidly between views, following your natural train of thought. You’re not stuck in wizards or bogged down writing scripts. You just create beautiful, rich data visualizations.  It's so easy to use that any Excel user can learn it. Get more results for less effort. And it’s 10 –100x faster than existing solutions.

Tableau server
Tableau  Server  is  a  business  intelligence  application  that  provides  browser-based  analytics anyone can use. It’s a rapid-fire alternative to th…

The Sqoop in Hadoop story to process structural data

Why Sqoop you need while working on Hadoop-The Sqoop and its primary reason is to import data from structural data sources such as Oracle/DB2 into HDFS(also called Hadoop file system).
To our readers, I have collected a good video from Edureka which helps you to understand the functionality of Sqoop.

The comparison between Sqoop and Flume

The Sqoop the word came from SQL+Hadoop Sqoop word came from SQL+HADOOP=SQOOP. And Sqoop is a data transfer tool. The main use of Sqoop is to import and export the large amount of data from RDBMS to HDFS and vice versa. List of basic Sqoop commands Codegen- It helps to generate code to interact with database records.Create-hive-table- It helps to Import a table definition into a hiveEval- It helps to evaluateSQL statement and display the resultsExport-It helps to export an HDFS directory into a database tableHelp- It helps to list the available commandsImport- It helps to import a table from a database to HDFSImport-all-tables- It helps to import tables …

The best 5 differences of AWS EMR and Hadoop

With Amazon Elastic MapReduce (Amazon EMR) you can analyze and process vast amounts of data. It does this by distributing the computational work across a cluster of virtual servers running in the Amazon cloud. The cluster is managed using an open-source framework called Hadoop.

Amazon EMR has made enhancements to Hadoop and other open-source applications to work seamlessly with AWS. For example, Hadoop clusters running on Amazon EMR use EC2 instances as virtual Linux servers for the master and slave nodes, Amazon S3 for bulk storage of input and output data, and CloudWatch to monitor cluster performance and raise alarms.

You can also move data into and out of DynamoDB using Amazon EMR and Hive. All of this is orchestrated by Amazon EMR control software that launches and manages the Hadoop cluster. This process is called an Amazon EMR cluster.


What does Hadoop do...

Hadoop uses a distributed processing architecture called MapReduce in which a task is mapped to a set of servers for proce…