Ankith Reddy

Ankith Reddy

730 Articles Published

Articles by Ankith Reddy

Page 48 of 73

How it is possible in MySQL to find a string of specified pattern within another string?

Ankith Reddy
Ankith Reddy
Updated on 04-Feb-2020 157 Views

We can find a string of specified pattern within another string by using LIKE operator along with WILDCARDS.SyntaxLIKE specific_patternSpecific_pattern is the pattern of string we want to find out within another string.ExampleSuppose we have a table named ‘student’ having names of the students and we want to get the details of all those students which are having the pattern of string ‘av’ within their names. It can be done with the help of following MySQL query −mysql> Select * from Student Where Name LIKE '%av%'; +------+--------+---------+-----------+ | Id   | Name   | Address | Subject   | +------+--------+---------+-----------+ ...

Read More

Do we have any lower and upper limit of base in MySQL CONV() function? What happens if out of limit base is provided in CONV() function?

Ankith Reddy
Ankith Reddy
Updated on 04-Feb-2020 169 Views

The base must be greater than 2 and less than 36 i.e. the lower limit of a base is 2 and the upper limit is 36. It is applied to both from_base and to_base values. If in case we provide out of limit values of the base then MySQL returns NULL as the output. Following example will demonstrate it −Examplemysql> Select CONV(10,10,38); +----------------+ | CONV(10,10,38) | +----------------+ | NULL | +----------------+ 1 row in set (0.00 sec) mysql> Select CONV(10,72,2); +---------------+ | CONV(10,72,2) | +---------------+ | NULL | +---------------+ 1 row in set (0.00 sec) mysql> Select CONV(10,10,1); +---------------+ | CONV(10,10,1) | +---------------+ | NULL | +---------------+ 1 row in set (0.00 sec)

Read More

How can we know the repetition of a value in column with the help of group function COUNT(*) and GROUP BY clause?

Ankith Reddy
Ankith Reddy
Updated on 30-Jan-2020 223 Views

We can use COUNT(*) and GROUP BY clause to find out the repetition of a value in the column. Following is the example, using COUNT(*) and GROUP BY clause on ‘Name’ column of table ‘Student’, to demonstrate it −mysql> select count(*), name from student group by name; +----------+---------+ | count(*) | name | +----------+---------+ | 1 | Aarav | | 2 | Gaurav | | 1 | Harshit | +----------+---------+ 3 ...

Read More

How can we fetch one or more columns as output from a MySQL table?

Ankith Reddy
Ankith Reddy
Updated on 29-Jan-2020 324 Views

The SELECT command can be used to fetch one or more columns as output from MySQL table. An  example is given below to fetch one or more columnsmysql> Select * from Student; +------+---------+---------+-----------+ | Id   | Name    | Address | Subject   | +------+---------+---------+-----------+ | 1    | Gaurav  | Delhi   | Computers | | 2    | Aarav   | Mumbai  | History   | | 15   | Harshit | Delhi   | Commerce  | | 17   | Raman   | Shimla  | Computers | +------+---------+---------+-----------+ 4 rows in set (0.01 sec) ...

Read More

What is the concept of CTAS (CREATE TABLE AS SELECTED) in MySQL?

Ankith Reddy
Ankith Reddy
Updated on 29-Jan-2020 789 Views

CTAS i.e. “Create Table AS Select” script is used to create a table from an existing table. It copies the table structure as well as data from the existing table. Consider the following example in which we have created a table named EMP_BACKUP from an already existing table named ‘Employee’mysql> Select * from Employee; +------+--------+ | Id | Name | +------+--------+ | 100 | Ram | | 200 | Gaurav | | 300 | Mohan | +------+--------+ 3 rows in set (0.00 sec)The query above shows the ...

Read More

What is the way to check the size of all the MySQL databases?

Ankith Reddy
Ankith Reddy
Updated on 28-Jan-2020 168 Views

We can check the size of all MySQL databases with the help of the following statementmysql> SELECT table_schema "Database", -> SUM(data_length + index_length)/1024/1024 "Size in MB" -> FROM information_schema.TABLES GROUP BY table_schema; +--------------------+----------------+ | Database           | Size in MB     | +--------------------+----------------+ | gaurav             | 1.04785156     | | information_schema | 0.00878906     | | mysql              | 0.68551350     | | performance_schema | 0.00000000     | | sample             | 0.04687500     | | tutorial           | 0.03125000     | +--------------------+----------------+ 6 rows in set, 1 warning (0.33 sec)

Read More

How to add picasso library in android studio?

Ankith Reddy
Ankith Reddy
Updated on 27-Jan-2020 1K+ Views

Before getting into picasso library example, we should know about picasso. Picasso is image processing library and developed by Square Inc. In older days we used to write lengthy of codes to grab image from server or do process., to optimize the process picasso introduced.This example demonstrate about how to integrate picasso library in android studio.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code in build.gradle.apply plugin: 'com.android.application' android {    compileSdkVersion 28    defaultConfig {   ...

Read More

C++ Program to Find the Number of Ways to Write a Number as the Sum of Numbers Smaller than Itself

Ankith Reddy
Ankith Reddy
Updated on 30-Jul-2019 295 Views

In this program we will count the number of ways one number can be represented by sum of numbers smaller than itself. This program will count the partition of given numbers. We take a number n as input, then starting from a number break it by removing 1 at a time. If the new partition is generated, increase the counter.AlgorithmpartitionCount(n)Input : The number nOutput : The number of partitionsBegin    Create array p of size n    k := 0    count := -1    put n as the first element of array p    Repeat the following steps, do ...

Read More

How do I avoid the variable value in a MySQL stored procedure to change when records are updated?

Ankith Reddy
Ankith Reddy
Updated on 30-Jul-2019 239 Views

We will create a stored procedure that does not change the variable value whenever the value is updated.Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Value int    ); Query OK, 0 rows affected (0.63 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Value) values(100); Query OK, 1 row affected (0.13 sec) Display all records from the table using select statement : mysql> select *from DemoTable;Output+----+-------+ | Id | Value | +----+-------+ | 1 | 100 | +----+-------+ 1 row ...

Read More

What is the precision of floating point in C++?

Ankith Reddy
Ankith Reddy
Updated on 30-Jul-2019 1K+ Views

In C++, the size of the floating point number is either 4-byte or 8-bytes. So it can store up to few decimal places. For example, the 1/3 = 0.333333…… Up to infinity. If we store it inside floating type variable, then it will store some significant digits. The default value is 6. So normally floating point numbers in C++ can display up to 6 decimal places.We can change the size of the precision using setprecision. This is present inside the iomanip header file. Let us see one example to get the idea.Example Code#include #include using namespace std; int ...

Read More
Showing 471–480 of 730 articles
« Prev 1 46 47 48 49 50 73 Next »
Advertisements