- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- 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
Found 4378 Articles for MySQL
228 Views
To illustrate it we are creating the following views −mysql> CREATE VIEW digits AS -> SELECT 0 AS digit UNION ALL -> SELECT 1 UNION ALL -> SELECT 2 UNION ALL -> SELECT 3 UNION ALL -> SELECT 4 UNION ALL -> SELECT 5 UNION ALL -> SELECT 6 UNION ALL -> SELECT 7 UNION ALL -> SELECT 8 UNION ALL -> SELECT 9; Query OK, 0 rows affected (0.08 sec) mysql> CREATE VIEW numbers AS SELECT ones.digit + ... Read More
286 Views
We can use the if...else condition in PHP script to prepare a query based on the NULL value. To illustrate it we are having the following example −ExampleIn this example, we are using the table named ‘tcount_tbl’ having the following data −mysql> SELECT * from tcount_tbl; +-----------------+----------------+ | tutorial_author | tutorial_count | +-----------------+----------------+ | mahran | 20 | | mahnaz | NULL | | Jen | NULL | | Gill | 20 | +-----------------+----------------+ 4 rows in set (0.00 sec)Now, the following is a PHP script that takes the value of ‘tutorial_count’ from outside and compares it with the value available in the field.
4K+ Views
We can use the syntax of MySQL JOIN for joining two tables into the PHP function – mysql_query(). This function is used to execute the SQL command and later another PHP function – mysql_fetch_array() can be used to fetch all the selected data.To illustrate it we are having the following example −ExampleIn this example, we are using two MySQL tables which have the following data −mysql> SELECT * FROM tcount_tbl; +-----------------+----------------+ | tutorial_author | tutorial_count | +-----------------+----------------+ | mahran | 20 | | mahnaz | ... Read More
181 Views
We can use the similar syntax of the ORDER BY clause into the PHP function – mysql_query(). This function is used to execute the SQL command and later another PHP function – mysql_fetch_array() can be used to fetch all the selected data.To illustrate it we are having the following example −ExampleIn this example, we are writing a PHP script that will return the result in descending order of the authors of the tutorial −
283 Views
We can use the similar syntax of the WHERE...LIKE clause into the PHP function – mysql_query(). This function is used to execute the SQL command and later another PHP function – mysql_fetch_array() can be used to fetch all the selected data if the WHERE...LIKE clause is used along with the SELECT command.But if the WHERE...LIKE clause is being used with the DELETE or UPDATE command, then no further PHP function call is required.To illustrate it we are having the following example −ExampleIn this example, we are writing a PHP script that will return all the records from the table named ‘tutorial_tbl’ ... Read More
117 Views
As we know that MySQL BETWEEN operator can be used to select values from some range of values. We can use BETWEEN operator along with views to select some range of values from the base table. To understand this concept we are using the base table ‘student_info’ having the following data −mysql> Select * from Student_info; +------+---------+------------+------------+ | id | Name | Address | Subject | +------+---------+------------+------------+ | 101 | YashPal | Amritsar | History | | 105 | Gaurav | Chandigarh | Literature | | 125 | Raman | Shimla ... Read More
99 Views
MySQL LIKE operator is used to select data based on pattern matching. Similarly, we can use LIKE operator with views to select particular data based on pattern matching from the base table. To understand this concept we are using the base table ‘student_info’ having the following data −mysql> Select * from Student_info; +------+---------+------------+------------+ | id | Name | Address | Subject | +------+---------+------------+------------+ | 101 | YashPal | Amritsar | History | | 105 | Gaurav | Chandigarh | Literature | | 125 | Raman | Shimla | Computers | | 130 | ... Read More
2K+ Views
We can use GROUP BY to group values from a column, and, if we want, we can perform calculations on that column. You can use COUNT, SUM, AVG, etc., functions on the grouped column. To understand GROUP BY clause with views we are creating a view named ‘Info’ using the base table ‘Student_info’ having the following data − mysql> Select * from Student_info; +------+---------+------------+------------+ | id | Name | Address | Subject | +------+---------+------------+------------+ | 101 | YashPal | Amritsar | History ... Read More
233 Views
We can use the SQL DELETE command with or without the WHERE CLAUSE into the PHP function – mysql_query(). This function will execute the SQL command in a similar way it is executed at the mysql> prompt. To illustrate it we are having the following example − Example In this example, we are writing a PHP script to delete a record from MySQL table named ‘tutorial_tbl’ whose tutorial_id as 3.
217 Views
We can use the SQL UPDATE command with or without the WHERE CLAUSE in the PHP function – mysql_query(). This function will execute the SQL command in a similar way it is executed at the mysql> prompt. To illustrate it we are having the following example −ExampleIn this example, we are writing a PHP script to update the field named tutorial_title for a record having turorial_id as 3.