Return 0 for Null in MySQL

Chandu yadav
Updated on 30-Jul-2019 22:30:23

19K+ Views

We can return 0 for NULL in MySQL with the help of IFNULL() method. The syntax of IFNULL() is as follows. IFNULL(YOUREXPRESSION, 0); Let us see an example. First, we will create a table. mysql> create table NullDemoWithZero -> ( -> id varchar(200) -> ); Query OK, 0 rows affected (0.65 sec) After creating a table, let us insert some records in the table using the INSERT command. The query is as follows − mysql> insert into NullDemoWithZero values(); Query OK, 1 row affected (0.16 sec) ... Read More

Difference Between Boxing and Unboxing in C#

Samual Sam
Updated on 30-Jul-2019 22:30:23

1K+ Views

Boxing convert value type to an object type whereas unboxing converts object type to the value type. Let us see the difference between Boxing and Unboxing in C#. Storage In boxing, the value stored on the stack is copied to the object stored on heap memory, whereas unboxing is the opposite. In Unboxing, the object's value stored on the heap memory is copied to the value type stored on stack. Conversion Unboxing has explicit conversion whereas boxing has implicit conversion. Example int a = 10; object obj = a; // boxing int b = (int) ob; // unboxing

Escape Apostrophe in MySQL

Arjun Thakur
Updated on 30-Jul-2019 22:30:23

3K+ Views

We can escape apostrophe (‘) in MySQL in the following two ways − We can use backslash. We can use single quotes twice (double quoted) Using backslash Let us first create a table. mysql> create table SingleQuotesDemo - > ( - > id int, - > name varchar(100) - > ); Query OK, 0 rows affected (1.16 sec) Following direct usage does not give the desired result for name “John’s”. mysql> insert into SingleQuotesDemo values(1, 'John's'); '> Let us now use backslash. ... Read More

Get a List of MySQL User Accounts

Arjun Thakur
Updated on 30-Jul-2019 22:30:23

190 Views

To get the list of MySQL user accounts, we can use “SELECT USER”. The following is the query to display the list. SELECT User FROM mysql.user; Here is the output. +------------------+ | User | +------------------+ | John | | Mac | | Manish | | mysql.infoschema | | mysql.session ... Read More

Difference Between String and StringBuilder in C#

Ankith Reddy
Updated on 30-Jul-2019 22:30:23

2K+ Views

Strings in C# String is immutable in C# that would mean you couldn’t modify it after it is created. It creates a new object of string type in memory if you will perform any operation. string str1 = "Welcome!"; // creates a new string instance str1 += "Hello"; str1 += "World”; StringBuilder in C# StringBuilder is mutable in C#. This means that if an operation is performed on the string, it will not create a new instance every time. With that, it will not create new space in memory, unlike Strings. StringBuilder str1 = new StringBuilder(""); str1.Append("Welcome!"); ... Read More

Function-Based Index in MySQL

Ankith Reddy
Updated on 30-Jul-2019 22:30:23

253 Views

Function-based index wasn’t possible in MySQL versions below 5.6. Firstly, to create function-based index in MySQL, we will create a table. mysql> create table FunctionIndexDemo - > ( - > FirstName varchar(100) - > ); Query OK, 0 rows affected (0.70 sec) Let us see the syntax to create a function based index. create index index_name on yourTableName (column_name(IntegerSize)); Here is the query. mysql> create index indFirstName on FunctionIndexDemo (FirstName(6)); Query OK, 0 rows affected (0.56 sec) Records: 0 Duplicates: 0 Warnings: 0 ... Read More

MySQL DESCRIBE Command

Ankith Reddy
Updated on 30-Jul-2019 22:30:23

9K+ Views

The MySQL’s DESCRIBE or DESC both are equivalent. The DESC is the short form of DESCRIBE command and used to dipslay the information about a table like column names and constraints on column name. The DESCRIBE command is equivalent to the following command − SHOW columns from yourTableName command. The following is the query that display information about a table with the help of DESCRIBE command. The query is as follows. mysql> DESCRIBE Student; Above, Student is the table name in my database. The above query generates the following output. +-------+--------------+------+-----+---------+-------+ | Field | Type ... Read More

Print First M Multiples of N in C#

Samual Sam
Updated on 30-Jul-2019 22:30:23

665 Views

To print m multiples of n, first set the value of m and n − int n = 6, m = 1; Now loop through the value of m, increment it and multiply with n on every iteration − while (m

Differences Between C++ and C#

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

425 Views

C++ is a statically typed, compiled, general-purpose, case-sensitive, free-form programming language that supports procedural, object-oriented, and generic programming. C++ is regarded as a middle-level language, as it comprises a combination of both high-level and low-level language features. C# is a simple, modern, general-purpose, object-oriented programming language developed by Microsoft within its .NET initiative led by Anders Hejlsberg. The following are the differences between C++and C#. Memory Management C++ has manual memory management, whereas memory management is handled automatically in C#. Platforms C++ can be run on different platforms whereas C# is generally used only on Windows. Faster code C++ code ... Read More

Check the Validity of a Password in Python

Samual Sam
Updated on 30-Jul-2019 22:30:23

2K+ Views

Here given a password, our task is to check that this Password is valid or not. Here we use re module that provide regular expression and re.search() is used for checking the validation of alphabets, digits or special characters. Algorithm Step 1: first we take an alphanumeric string as a password. Step 2: first check that this string should minimum 8 characters. Step 3: the alphabets must be between a-z. Step 4: At least one alphabet should be in Uppercase A-Z. Step 5: At least 1 number or digit between 0-9. Step 6: At least 1 character from [_ ... Read More

Advertisements