Insert Current Date and Time in MySQL

Chandu yadav
Updated on 02-Sep-2023 15:55:56

55K+ Views

To insert only date value, use curdate() in MySQL. With that, if you want to get the entire datetime, then you can use now() method.Let us first create a table −mysql> create table CurDateDemo -> ( -> ArrivalDate datetime -> ); Query OK, 0 rows affected (0.74 sec)Now you can insert only date with the help of curdate() method −mysql> insert into CurDateDemo values(curdate()); Query OK, 1 row affected (0.15 sec)Display the inserted date with the help of select statement. The query is as follows −mysql> select *from CurDateDemo;Here is the ... Read More

Set Cell Padding in HTML

Lokesh Badavath
Updated on 02-Sep-2023 15:53:32

51K+ Views

We use the inline style attribute, to set cell padding in HTML. Cell padding is the space between cell borders of the table and the content within a cell of the table. The style attribute is used inside the HTML tag, with the CSS property called padding with a specified value in pixels. Syntax Following is the syntax to set cell padding in HTML. table header Example Following is an example program to set cell padding in HTML. DOCTYPE html> table, th, td { ... Read More

Check If a Column is Empty or NULL in MySQL

George John
Updated on 02-Sep-2023 15:49:47

48K+ Views

To check if a column is empty or null , we can use the WHERE clause with IS NULL and for empty we can use the condition ' ' i.e., empty space. The steps required for this are as folllows: First a table is created with the help of CREATE command as follows −mysql> CREATE table ColumnValueNullDemo -> ( -> ColumnName varchar(100) -> ); Query OK, 0 rows affected (0.61 sec)An empty value is inserted into the table using INSERT command. This is given below −mysql> INSERT into ColumnValueNullDemo values(' '); Query OK, 1 row affected (0.14 sec)After that, the ... Read More

Convert String to Array in JavaScript

Nikhilesh Aleti
Updated on 02-Sep-2023 15:45:46

48K+ Views

The task we need to accomplish is converting an input string to an array in JavaScript. Whenever we try to break a string word into characters or a sentence into words – splitting into arrays, we have some built-in methods to convert string to an array. In this article, we will discuss how to convert the string to an array using different methods in JavaScript. Using the split() method This method will split the string to an array of substrings. This will return the output in a new array and will not change the existing string. The split() method accepts ... Read More

Basic Concepts of Object-Oriented Programming Using C++

sudhir sharma
Updated on 02-Sep-2023 15:38:57

49K+ Views

Object oriented programming is a type of programming which uses objects and classes its functioning. The object oriented programming is based on real world entities like inheritance, polymorphism, data hiding, etc. It aims at binding together data and function work on these data sets into a single entity to restrict their usage.Some basic concepts of object oriented programming are −CLASSOBJECTSENCAPSULATIONPOLYMORPHISMINHERITANCEABSTRACTIONClass − A class is a data-type that has its own members i.e. data members and member functions. It is the blueprint for an object in object oriented programming language. It is the basic building block of object oriented programming in ... Read More

Differences Between Pure Aloha and Slotted Aloha

Kiran Kumar Panigrahi
Updated on 02-Sep-2023 15:32:54

57K+ Views

The Aloha Protocol allows several stations to send data frames over the same communication channel at the same time. This protocol is a straightforward communication method in which each network station is given equal priority and works independently.Aloha is a medium access control (MAC) protocol for transmission of data via a shared network channel. Using this protocol, several data streams originating from multiple nodes are transferred through a multi-point transmission channel.There are two types of Aloha protocols − Pure Aloha and Slotted Aloha.In Pure Aloha, the time of transmission is continuous. Whenever a station has an available frame, it sends ... Read More

Determine if a Number is Odd or Even in JavaScript

Shubham Vora
Updated on 02-Sep-2023 15:30:06

44K+ Views

In this tutorial, let’s see how to determine whether a number is odd or even using JavaScript. The first step is understanding the logic. What are even numbers? Even numbers will be exactly divisible by 2. The remainder will be zero. What are odd numbers? Odd numbers will carry a remainder when divided by 2. Using the if-else Condition and Modulo Operator "if" will check a condition, and the if block code will be executed if the condition is true. If the condition is false, else block code will be executed. The modulo operator in JavaScript returns the remainder. Syntax ... Read More

Convert Integer to String in C#

karthikeya Boyini
Updated on 02-Sep-2023 15:26:43

46K+ Views

To convert an integer to string in C#, use the ToString() method.Set the integer for which you want the string −int num = 299;Use the ToString() method to convert Integer to String −String s; int num = 299; s = num.ToString();ExampleYou can try to run the following code to convert an integer to string in C# −Live Demousing System; class MyApplication {    static void Main(string[] args) {       String s;       int num = 299;       s = num.ToString();       Console.WriteLine("String = "+s);       Console.ReadLine();    } }OutputString = 299

Calculate Transpose of a Matrix Using C Program

Mandalika
Updated on 02-Sep-2023 15:21:37

53K+ Views

Transpose of a matrixThe transpose of a matrix is the one whose rows are columns of the original matrix, i.e. if A and B are two matrices such that the rows of the matrix B are the columns of the matrix A then Matrix B is said to be the transpose of Matrix A.The logic used to change m(i, j) matrix to m(j, i) is as follows −for (i = 0;i < m;i++)    for (j = 0; j < n; j++)       transpose[j][i] = matrix[i][j];Program 1In this example, we shall print the transpose of a matrix using for ... Read More

Measure Execution Time for a Java Method

Maruthi Krishna
Updated on 02-Sep-2023 15:19:24

62K+ Views

In general, the elapsed time is the time from the starting point to ending point of an event. Following are various ways to find elapsed time in Java −The currentTimeMillis() method returns the current time in milliseconds. To find the elapsed time for a method you can get the difference between time values before and after the execution of the desired method.The nanoTime() method returns the current time in nano seconds. To find the elapsed time for a method you can get the difference between time values before and after the execution of the desired method.The now() method of the ... Read More

Advertisements