Vrundesha Joshi has Published 345 Articles

How can we select a MySQL database by using PHP script?

Vrundesha Joshi

Vrundesha Joshi

Updated on 22-Jun-2020 13:33:45

93 Views

As we know that PHP provides us the function named mysql_select_db to select a mysql database.ExampleTo illustrate this we are selecting a database named ‘Tutorials’ with the help of PHP script in the following example −           Selecting MySQL Database                  

How can we find the employees from MySQL table whose age is greater than say 30 years, providing the only date of birth on the table?

Vrundesha Joshi

Vrundesha Joshi

Updated on 22-Jun-2020 12:37:37

1K+ Views

To understand this concept, we are using the data from table ‘emp_tbl’ as follows −mysql> Select * from emp_tbl; +--------+------------+ | Name   | DOB        | +--------+------------+ | Gaurav | 1984-01-17 | | Gaurav | 1990-01-17 | | Rahul  | 1980-05-22 | | Gurdas | 1981-05-25 | ... Read More

How can I get the output of multiple MySQL tables from a single query?

Vrundesha Joshi

Vrundesha Joshi

Updated on 22-Jun-2020 11:41:03

219 Views

As we know that a query can have multiple MySQL statements followed by a semicolon. Suppose if we want to get the result from multiple tables then consider the following example to get the result set from ‘Student_info’ and ‘Student_detail’ by writing a single query −mysql> Select Name, Address from ... Read More

How we can get more information about columns of a table than theinformation we got by DESCRIBE, EXPLAIN and SHOW COLUMNS MySQL statements?

Vrundesha Joshi

Vrundesha Joshi

Updated on 22-Jun-2020 08:34:54

67 Views

With the statement SHOW FULL COLUMNS, we can get more information about the columns of a table than the information we got by DESCRIBE, EXPLAIN, and SHOW COLUMNS MySQL statements.SyntaxSHOW FULL COLUMNS from Table_name;Examplemysql> SHOW FULL COLUMNS FROM EMPLOYEE\G; *************************** 1. row ***************************      Field: ID     ... Read More

How can we amend the declared size of a column’s data type in MySQL?

Vrundesha Joshi

Vrundesha Joshi

Updated on 22-Jun-2020 08:33:02

62 Views

It can be done with the help of ALTER TABLE command of MySQL. Consider the table ‘Student’ in which the size of ‘Grade’ column is declared as Varchar(10), can be seen from the following query −mysql> DESCRIBE Student; +--------+-------------+------+-----+---------+-------+ | Field  | Type        | Null | Key ... Read More

How can we create MySQL stored procedures without ‘BEGIN’ and ‘END’?

Vrundesha Joshi

Vrundesha Joshi

Updated on 22-Jun-2020 07:20:52

348 Views

We can create MySQL stored procedures without ‘BEGIN’ and ‘END’ just in the same way created with both of them only thing is to omit to BEGIN and END. In the following example, we are creating a stored procedure without ‘BEGIN’ and ‘END’ to get all the rows from a ... Read More

How can a MySQL stored procedure call another MySQL stored procedure inside it?

Vrundesha Joshi

Vrundesha Joshi

Updated on 22-Jun-2020 06:48:26

3K+ Views

It is quite possible that a MySQL stored procedure can call another MySQL stored procedure inside it. To demonstrate it, we are taking an example in which a stored procedure will call another stored procedure to find out the last_insert_id.Examplemysql> Create table employee.tbl(Id INT NOT NULL AUTO_INCREMENT, Name Varchar(30) NOT ... Read More

How can we subtract values in MySQL table with the help of LEFT JOIN?

Vrundesha Joshi

Vrundesha Joshi

Updated on 20-Jun-2020 11:17:24

714 Views

It can be understood with the help of an example in which two tables are having some values and we subtract the values with the help of LEFT JOIN. Here we are taking two tables having the following data −mysql> Select * from value_curdate; +----+----------+-------+ | Id | Product  | ... Read More

How can we take a backup of multiple databases by using mysqldump client program?

Vrundesha Joshi

Vrundesha Joshi

Updated on 20-Jun-2020 10:40:35

3K+ Views

By using mysql dump client program we can take the backup of multiple databases into a file having the extension ‘.sql’. It can be understood with the help of the following example −ExampleIn this example, with the help of mysql dump client program, we are taking the backup of two ... Read More

What is the use of NCHAR in MySQL?

Vrundesha Joshi

Vrundesha Joshi

Updated on 20-Jun-2020 07:37:27

668 Views

MySQL defines NCHAR as a way to indicate that a CHAR column should use predefined character set. Utf8 is used by MySQL as its predefined character set.ExampleIn the example below, we are creating a table named ‘Student1’. In this table, we are declaring the data types of three columns with ... Read More

Previous 1 ... 3 4 5 6 7 ... 35 Next
Advertisements