Found 6702 Articles for Database

How can we get the structure of a MySQL view as we can get the structure of a MySQL table?

Arjun Thakur
Updated on 22-Jun-2020 13:41:44

299 Views

As we know that views are a type of virtual tables and are a composition of tables too hence we can use the same query to get the structure of a view which we use to get the structure of a table. In other words, we can use DESCRIBE statement to get the structure of a MySQL view. Its syntax would be as follows −SyntaxDESCRIBE view_name;Here, view_name is the name of the view of which we want to get the structure.ExampleSuppose we want to get the structure of a view named ‘Info’ then it can be done with the help, of the following query ... Read More

How can we drop a MySQL view from the database?

Akshaya Akki
Updated on 22-Jun-2020 13:43:50

83 Views

With the help of DROP VIEW statement, we can drop a MySQL view from the database. Its syntax would be as follows −SyntaxDROP VIEW [IF EXISTS] view_name;Here view_name is the name of the view which we want to delete from the database.ExampleSuppose if we want to drop a view named info_less then the following query will delete if −mysql> DROP VIEW IF EXISTS Info_less; Query OK, 0 rows affected (0.03 sec)

How can we display all the records from MySQL table with the help of PHP script that uses mysql_fetch_assoc() function?

seetha
Updated on 22-Jun-2020 13:57:51

350 Views

To illustrate this we are fetching all the records from a table named ‘Tutorials_tbl’ with the help of PHP script that uses mysql_fetch_assoc() function in the following example −Example

How can we display all the records from MySQL table with the help of PHP script?

Priya Pallavi
Updated on 22-Jun-2020 13:52:00

874 Views

To illustrate this we are fetching all the records from a table named ‘Tutorials_tbl’ with the help of PHP script that uses mysql_query() and mysql_fetch_array() function in the following example −

Which PHP functions are used in the PHP script to fetch data from an existing MySQL table?

Nikitha N
Updated on 22-Jun-2020 13:55:09

91 Views

PHP uses following functions to fetch data from an existing MySQL table −mysql_query() functionThis function is used in PHP script to fetch data from an existing MySQL table. This function takes two parameters and returns TRUE on success or FALSE on failure. Its syntax is as follows −Syntaxbool mysql_query( sql, connection );Followings are the parameters used in this function −S. No.Parameter & Description1.SqlRequired - SQL query to fetch data from an existing MySQL table2.connectionOptional - if not specified, then the last opened connection by mysql_connect will be used.mysql_fetch_array() functionThis is another function which is used in PHP script while fetching ... Read More

How can we insert data into an existing MySQL table by using PHP script?

Anvi Jain
Updated on 22-Jun-2020 14:03:52

437 Views

As we know that PHP provides us the function named mysql_query to insert data into an existing MySQL table.ExampleTo illustrate this we are inserting data into a table named ‘Tutorials_tbl’ with the help of PHP script in the following example −           Add New Record in MySQL Database              

Which PHP function is used to insert data into an existing MySQL table?

Srinivas Gorla
Updated on 22-Jun-2020 13:40:55

79 Views

PHP uses a mysql_query function to insert data into an existing MySQL table. This function takes two parameters and returns TRUE on success or FALSE on failure. Its syntax is as follows −Syntaxbool mysql_query( sql, connection );Followings are the parameters used in this function −S. No.Parameter & Description1.SqlRequired - SQL query to insert data into an existing MySQL table2.connectionOptional - if not specified, then the last opened connection by mysql_connect will be used.

How can we delete an existing MySQL table by using PHP script?

Nitya Raut
Updated on 22-Jun-2020 13:43:01

100 Views

As we know that PHP provides us the function named mysql_query to delete an existing MySQL table.ExampleTo illustrate this we are deleting a table named ‘Tutorials_tbl’ with the help of PHP script in the following example −           Creating MySQL Tables                  

Which PHP function is used to delete an existing MySQL table?

Abhinanda Shri
Updated on 22-Jun-2020 13:44:39

79 Views

PHP uses mysql_query function to delete an existing MySQL table. This function takes two parameters and returns TRUE on success or FALSE on failure. Its syntax is as follows −Syntaxbool mysql_query( sql, connection );Followings are the parameters used in this function −S. No.Parameter & Description1.SqlRequired - SQL query to delete an existing MySQL table2.connectionOptional - if not specified, then the last opened connection by mysql_connect will be used.

How can we see the metadata of a view(s) stored in a particular MySQL database?

Lakshmi Srinivas
Updated on 22-Jun-2020 13:45:15

154 Views

The INFORMATION_SCHEMA database has a VIEWS table that contains view metadata i.e. data about views. To illustrate it we are taking the example of a view named ‘Info’.ExampleThe following query will show the metadata of a view named ‘Info’ −mysql> SELECT * from INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'Info' AND TABLE_SCHEMA = 'query'\G *************************** 1. row *************************** TABLE_CATALOG: def  TABLE_SCHEMA: query    TABLE_NAME: info VIEW_DEFINITION:select`query`.`student_info`.`id`AS`ID`, `query`.`student_info`.`Name` AS `NAME`, `query`.`student_info`.`Subject` AS `SUBJECT`, `query`.` student_info`.`Address` AS `ADDRESS` from `query`.`student_info`         CHECK_OPTION: NONE         IS_UPDATABLE: YES              DEFINER: root@localhost       ... Read More

Advertisements