Monica Mona has Published 85 Articles

What MySQL CHAR_LENGTH() function returns if no parameter is provided to it?

Monica Mona

Monica Mona

Updated on 20-Jun-2020 07:48:07

114 Views

In this case, it means we are providing an empty string as an argument to the CHAR_LENGTH() function. It will return 0 on providing empty string because there are no characters to be counted by CHAR_LENGTH() function.Examplemysql> Select CHAR_LENGTH(''); +-----------------+ | CHAR_LENGTH('') | +-----------------+ | 0         ... Read More

What is the significant difference between MySQL TRUNCATE and DROP command?

Monica Mona

Monica Mona

Updated on 20-Jun-2020 06:01:19

165 Views

The most significant difference between MySQL TRUNCATE and DROP command is that TRUNCATE command will not destroy table’s structure but in contrast DROP command will destroy table’s structure too.Examplemysql> Create table testing(id int PRIMARY KEY NOT NULL AUTO_INCREMENT, Name Varchar(20)); Query OK, 0 rows affected (0.24 sec) mysql> Insert ... Read More

How to add columns to an existing MySQL table?

Monica Mona

Monica Mona

Updated on 19-Jun-2020 13:54:18

345 Views

By using ALTER command we can add columns to an existing table.SyntaxAlter table table-name ADD (column-name datatype);Example In the example below, with the help of ALTER Command, column ‘GRADE’ is added to the table ‘Student’.mysql> Alter table Student ADD (Grade Varchar(10)); Query OK, 5 rows affected (1.05 sec) Records: 5 Duplicates: ... Read More

How can we assign FOREIGN KEY constraint on multiple columns?

Monica Mona

Monica Mona

Updated on 19-Jun-2020 13:37:15

4K+ Views

MySQL allows us to add a FOREIGN KEY constraint on multiple columns in a table. The condition is that each Foreign Key in the child table must refer to the different parent table.ExampleSuppose we have a table ‘customer2’ which have a Primary Key constraint on the field ‘cust_unq_id’ as follows ... Read More

How to print a complete tuple in Python using string formatting?

Monica Mona

Monica Mona

Updated on 17-Jun-2020 10:18:15

563 Views

When using the old style of string formatting in python, ie, "" % (), if the thing after the percent is a tuple, python tries to break it down and pass individual items in it to the string. For example, tup = (1, 2, 3) print("this is a tuple %s" ... Read More

What is 'Space Complexity’?

Monica Mona

Monica Mona

Updated on 17-Jun-2020 10:08:53

5K+ Views

Space ComplexitySpace complexity is an amount of memory used by the algorithm (including the input values of the algorithm), to execute it completely and produce the result.We know that to execute an algorithm it must be loaded in the main memory. The memory can be used in different forms:Variables (This ... Read More

Parity Check of a Number

Monica Mona

Monica Mona

Updated on 17-Jun-2020 09:54:17

5K+ Views

Parity of a number is based on the number of 1’s present in the binary equivalent of that number. When the count of present 1s is odd, it returns odd parity, for an even number of 1s it returns even parity.As we know that the numbers in computer memory are ... Read More

Find Weekday using Zeller's Algorithm

Monica Mona

Monica Mona

Updated on 17-Jun-2020 09:47:32

1K+ Views

Zeller’s Algorithm is used to find the weekday from a given date. The formula to find weekday using Zeller’s Algorithm is here:The formula is containing some variables; They are −d − The day of the date.m: It is the month code. From March to December it is 3 to 12, ... Read More

Number to Roman Numerals

Monica Mona

Monica Mona

Updated on 17-Jun-2020 09:39:10

586 Views

Roman numbers are non-positional numbers. Some numerals are placed together to form a number in roman numbers. For an example the number 75 can be expressed as 75 = 50 + 10 + 10 + 5, so the roman numerals are LXXV.In this problem one number is provided in a ... Read More

Flood fill Algorithm

Monica Mona

Monica Mona

Updated on 17-Jun-2020 09:30:02

1K+ Views

One matrix is given; the matrix is representing the one screen. Each element (i, j) of the screen is denoted as a pixel, the color of that pixel is marked with different numbers. In this algorithm, the pixels will be filled with new color when it is already in selected ... Read More

Advertisements