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

10 Tricky Interview Questions On Storm

Storm is real time computation system. It is a flagship software from Apache foundation. Has the capability to process in stream data. Storm is capable to integrate traditional databases. The list given below are tricky and highly useful for your next interview.
Bench mark for Storm is a million tuples processed per second per node. Tricky Interview Questions1) Real uses of Storm?

A) You can use in realtime analytics, online machine learning, continuous computation, distributed RPC, ETL

2) What are different availble layers on Storm?
FluxSQLStreams APITrident3)  Real use of SQL API on top of Storm?
A) You can run SQL queries on stream data
4) Most popular integrations to Storm? HDFSCassandraJDBCHIVEHBase 5) What are different possible Containers integration with Storm? YARNDOCKERMESOS6) What is Local Mode?

A) Running topologies in Local server we can say as Local Mode.

7) Where all the Events Stored in Storm?
A) Event Logger mechanism saves all events

8) What are Serializable data types in …

Blue Prism complete tutorials download now

Blueprsim is an automation tool useful to execute repetitive tasks without human effort. To learn this tool you need right material. Provided below quick reference materials to understand detailed elements, architecture and creating new bots. Useful if you are a new learner and trying to enter into automation career.
The number one and most popular tool in automation is Blue prism. In this post I have given references for popular materials and resources, so that you can use for your interviews.
Why You Need to Learn RPA blue prsim tutorial popular resources I have given in this post. You can download quickly. Learning Blue Prism is really good option if you are learner of Robotic process automation.
RPA Advantages The RPA is also called "Robotic Process Automation"- Real advantages are you can automate any business process and you can complete the customer requests in less time.

The Books Available on Blue Prism 
Blue Prism resourcesDavid chappal PDF bookBlue Prism BlogsVideo…

Blockchain Smart contract behind mechanism you need to learn quickly

Smart contract in Blockchain is a kind of software application that works without human intervention based on the transaction logs and provide solution to user request. I want to share the back end mechanism in Smart Contract of Blockchain. Smart Contract Mechanism What is Smart ContractA smart contract is a protocol which can auto execute, facilitate, verify or enforce the negotiation of a contract.Agreement between two parties you can say as a contract.Incorporating the rules of physical contract into computing world, you can say as smart contractBlockchain supports you to create smart contracts.Smart Contracts are self-executing programs which run on the blockchain and are capable of enforcing rulesUsing Blockchain as platform and making an agreement or contract between more than two parties, you can say as Smart Contract.Traditional Markets  4 Top Benefits of Smart ContractCurrently smart contracts are being used only in Crypto CurrenciesNow Smart Contracts being used in all financ…