• Home
  • ZarxBiz
  • Forum
Igniter Code
IgniterCode.com === Zarx.Biz
ReactJS

ecommerce cart react source code 2022 [ For Beginners ]

October 8, 2022 0 comment

Why and how to use sql views 2022

August 22, 2022 0 comment

how to import csv to mysql using php

August 22, 2022 0 comment
PHP

Code faster using visual studio Updated 2022

July 31, 2022 0 comment

Web socket crash course 2022 updated step by step

July 3, 2022 0 comment

How to use stored procedure in sql updated 2022

September 3, 2022 0 comment
MySQL

Must know mysql functions updated 2022

September 3, 2022 0 comment

PHP Composer Autoload Complete Guide 2022

August 13, 2022 0 comment
Tag:

sql views interview questions

Why and how to use sql views [ Super Easy ] for beginners
MySQL

Why and how to use sql views 2022

by Manu August 22, 2022
written by Manu

Hi Devs, Today we are going to see what exactly is SQL views and why you should use them. SQL views are the virtual tables created by you when you define a command to create a view. You can do all normal operation such as create,update,delete on views. Views can be very useful if used correctly.

Lets see How to Create a View

// To create a view.

mysqli_query($conn, "CREATE VIEW userCustomList AS SELECT first_name as name, age as user_age FROM users");

Here we are creating a view which will hold data “name” and “user_age” only from the main table.

Update a SQL View Selection

Incase you want to update a view

// Updating View Selection

mysqli_query($conn, "CREATE OR REPLACE VIEW userCustomList AS 
    SELECT first_name as name, age as user_age, salary FROM users WHERE salary > 90000");

Here we are also getting “salary” and we are getting only those users where salary more than 90000.

Update a Record In View

// Simple query to update view

mysqli_query($conn, "UPDATE userCustomList SET name = 'Something'");

Note : Update and delete will also take effect in original table as well, So be very careful. And take backup of your data.

Deleting A View

// This will delete the view.

mysqli_query($conn, "DROP VIEW userCustomList");

Incase you want to delete data from view

Delete Data From View

// Deleting data from view

mysqli_query($conn, "DELETE FROM userCustomList");

Note : Update and delete will also take effect in original table as well, So be very careful. And take backup of your data.

August 22, 2022 0 comment
0 FacebookTwitterPinterestEmail

Recent Posts

  • ecommerce cart react source code 2022 [ For Beginners ]
  • How to use stored procedure in sql updated 2022
  • Must know mysql functions updated 2022
  • Why and how to use sql views 2022
  • how to import csv to mysql using php

Recent Comments

No comments to show.
  • Facebook
  • Twitter
  • Youtube
  • Email

@2022 - All Right Reserved


Back To Top
Igniter Code
  • Home
  • ZarxBiz
  • Forum