Daniol Thomas has Published 212 Articles

How to set current time to some other time in JavaScript?

Daniol Thomas

Daniol Thomas

Updated on 23-Jun-2020 05:05:53

370 Views

You cannot do this with JavaScript since it takes the system time which displays the current date with Date object. However, you can change the current date by changing the timezone as in the following code −Example Live Demo                    var ... Read More

What are optional arguments in JavaScript Functions?

Daniol Thomas

Daniol Thomas

Updated on 22-Jun-2020 14:42:54

154 Views

To declare optional function parameters in JavaScript, use the “default” arguments.ExampleYou can try to run the following code to declare optional parameters −                    // default is set to 1          function inc(val1, inc = 1) {             return val1 + inc;          }          document.write(inc(10,10));          document.write("");          document.write(inc(10));          

Which PHP function is used to disconnect from MySQL database connection?

Daniol Thomas

Daniol Thomas

Updated on 22-Jun-2020 13:24:29

175 Views

PHP provides us mysql_close() function with the help of which we can disconnect from the MySQL database anytime. This function takes a single parameter, which is a connection returned by the mysql_connect() function. Its syntax is as follows −Syntaxbool mysql_close ( resource $link_identifier );Here, if a resource is not specified, ... Read More

In MySQL, how can we randomize set of rows or values in the result set?

Daniol Thomas

Daniol Thomas

Updated on 22-Jun-2020 12:29:33

67 Views

With the help of RAND() function used along with the ORDER BY clause, the set of rows or values can be randomized in the result set. To understand it considers a table ‘Employee’ having the following records −mysql> Select * from employee; +----+--------+--------+ | ID | Name   | Salary ... Read More

How to use ALTER TABLE statement for changing the size of a column in MySQL?

Daniol Thomas

Daniol Thomas

Updated on 22-Jun-2020 11:29:02

68 Views

It can be understood with the help of the following example using the table named ‘Student’ having the following description −mysql> DESCRIBE Student; +--------+-------------+------+-----+---------+-------+ | Field  | Type        | Null | Key | Default | Extra | +--------+-------------+------+-----+---------+-------+ | Name   | varchar(20) | YES  |   ... Read More

How can we see the source code of a particular MySQL stored function?

Daniol Thomas

Daniol Thomas

Updated on 22-Jun-2020 07:55:06

262 Views

With the help of SHOW CREATE FUNCTION statement, we can see the source code of a stored function. To make it understand we are using the stored function named Hello() in the query as follows −mysql> SHOW CREATE FUNCTION Hello\G *************************** 1. row ***************************           ... Read More

What happens when we use COMMIT in MySQL stored procedure and one of the transaction, under START transaction, fails?

Daniol Thomas

Daniol Thomas

Updated on 22-Jun-2020 06:57:24

467 Views

Suppose one of the queries fails or generates errors and another query (s) properly executed the MySQL still commit the changes of the properly executed query(s). It can be understood from the following example in which we are using the table ‘employee.tbl’ having the following data −Examplemysql> Select * from ... Read More

How can we drop a MySQL stored procedure?

Daniol Thomas

Daniol Thomas

Updated on 22-Jun-2020 06:55:19

182 Views

If we have ALTER ROUTINE privileges for the procedure then with the help of DROP PROCEDURE statement we can drop a MySQL stored procedure. To demonstrate it, we are dropping a stored procedure named ‘coursedetails’ as follows −mysql> DROP PROCEDURE coursedetails; Query OK, 0 rows affected (0.68 sec)The above query will ... Read More

How ANALYZE TABLE statement helps in maintaining the MySQL tables?

Daniol Thomas

Daniol Thomas

Updated on 20-Jun-2020 12:52:36

260 Views

MySQL query optimizer is an important element of the MySQL server that makes an best question execution set up for a query. For a particular query, the query optimizer uses the stored key distribution and other factors to decide the order in which tables should be joined when you performing ... Read More

How can I shutdown MySQL Server?

Daniol Thomas

Daniol Thomas

Updated on 20-Jun-2020 11:18:42

362 Views

With the help of ‘mysqladmin’ program we would be able to shutdown our MySQL server. It can be used as follows on command line −C:\mysql\bin>mysqladmin -u root shutdownWe will see nothing after entering the above command because it will not print any message in command window. We should have to ... Read More

Advertisements