Ankith Reddy has Published 995 Articles

Why should C++ programmers minimize use of 'new'?

Ankith Reddy

Ankith Reddy

Updated on 02-Mar-2020 08:07:45

152 Views

new is used for dynamic memory allocation. The memory allocated in this case goes on the heap. There are several costs associated with this type of memory allocation along with the programmer having to do manual memory cleaning and management. This type of allocation must be used when − You don't ... Read More

What should be the order in which libraries are linked in GCC?

Ankith Reddy

Ankith Reddy

Updated on 02-Mar-2020 07:52:22

1K+ Views

The linker searches from left to right. While doing so it encounters unresolved symbols which it keeps track of. If a library resolves the unresolved symbol, it takes the object files of that library to resolve the symbol.Dependencies of static libraries from each other work in the same way. Libraries ... Read More

How MySQL virtual GENERATED COLUMNS can work with mathematical expressions?

Ankith Reddy

Ankith Reddy

Updated on 21-Feb-2020 11:39:55

186 Views

It can be illustrated with the help of an example in which we are creating a virtual generated column in the table named ‘triangle’. As we know that virtual generated column can be generated with or without using the keyword ‘virtual’.Examplemysql> Create table triangle(SideA DOUBLE, SideB DOUBLE, SideC DOUBLE AS ... Read More

How MySQL can perform case-sensitive string comparison?

Ankith Reddy

Ankith Reddy

Updated on 17-Feb-2020 06:01:43

693 Views

As we know that MySQL is not case-sensitive while comparing characters but it can be changed i.e. MySQL can perform case-sensitive string comparison if we will use BINARY keyword before the expression. Actually, BINARY keyword instructs MySQL to compare the characters in the string using their underlying ASCII values rather ... Read More

Sorting a vector of custom objects using C++ STL

Ankith Reddy

Ankith Reddy

Updated on 12-Feb-2020 06:19:23

13K+ Views

You can sort a vector of custom objects using the C++ STL function std::sort. The sort function has an overloaded form that takes as arguments first, last, comparator. The first and last are iterators to first and last elements of the container. The comparator is a predicate function that can ... Read More

How can I use SPACE() function with MySQL WHERE clause?

Ankith Reddy

Ankith Reddy

Updated on 10-Feb-2020 06:24:38

319 Views

In this case, SPACE() function would add white spaces depending upon the condition given in WHERE clause. The following example from student table will demonstrate it.Examplemysql> Select Id, Name, Space(5) from student WHERE Name='Harshit'; +------+---------+----------+ | Id   | Name    | Space(5) | +------+---------+----------+ | 15   | Harshit ... Read More

What MySQL returns if the argument of QUOTE() function is NULL?

Ankith Reddy

Ankith Reddy

Updated on 07-Feb-2020 07:15:41

167 Views

MySQL returns NULL if the argument of QUOTE() function is NULL.Examplemysql> Select QUOTE(NULL); +-------------+ | QUOTE(NULL) | +-------------+ | NULL         +-------------+ 1 row in set (0.00 sec) mysql> Select Name, QUOTE(NULL) from student where id = 1; +--------+-------------+ | Name   | QUOTE(NULL) | +--------+-------------+ | Gaurav | NULL        | +--------+-------------+ 1 row in set (0.08 sec)

In MySQL, how can we check whether a string of a specified pattern is not present within another string?

Ankith Reddy

Ankith Reddy

Updated on 07-Feb-2020 06:45:36

161 Views

We can check whether a string of specified pattern is not present within another string by using NOT LIKE operator along with wildcard characters.SyntaxNOT LIKE specific_patternSpecific_pattern is the pattern of string we do not want to find out within another string.ExampleSuppose we have a table named ‘student’ having names of ... Read More

How can we use LPAD() or RPAD() functions with the values in the column of a MySQL table?

Ankith Reddy

Ankith Reddy

Updated on 06-Feb-2020 06:53:27

781 Views

For using LPAD() or RPAD() functions with the column values we need to specify the column name as the first argument of these functions. Following the example from ‘Student’ table will make it clearer −Examplemysql> Select Name, LPAD(Name, 10, '*') from student; +---------+-------------------+ | Name    | LPAD(Name, 10, ... Read More

What is the significance of using multiple columns in MySQL GROUP BY clause?

Ankith Reddy

Ankith Reddy

Updated on 06-Feb-2020 06:45:51

226 Views

By specifying multiple columns in GROUP BY clause we can split the result set into smaller groups. The more columns specified in GROUP BY clause, the smaller the groups will be.Examplemysql> Select designation, YEAR(Doj), count(*) from employees GROUP BY designation, YEAR(DoJ); +-------------+-----------+----------+ | designation | YEAR(Doj) | count(*) | ... Read More

Advertisements