Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

C++ Program to Compute Combinations using Recurrence Relation for nCr

karthikeya Boyini
Answered on 3rd May, 2019

This is a C++ program to compute Combinations using Recurrence Relation for nCr.AlgorithmsBegin    function CalCombination():       Arguments: n, r.       Body of the function:       Calculate combination by using       the formula: n! / (r! * (n-r)!. EndExample#include<iostream> using namespace std; ... Read More

Which one is better POW() or POWER() in MySQL?

Maheshwari Thakur
Answered on 3rd May, 2019

Both pow() and power() are synonyms in MySQL. Following is the syntax −select pow(yourValue1, yourValue2); OR select power(yourValue1, yourValue2);Let us implement both the above syntaxes.Using POW()mysql> select POW(4, 3);This will produce the following output −+----------+ | POW(4, 3) | +----------+ | 64 | +----------+ ... Read More

C++ Program to Generate a Sequence of N Characters for a Given Specific Case

Samual Sam
Answered on 3rd May, 2019

This is a C++ program to generate a sequence of N characters for a given specific case.AlgorithmsBegin    function GenerateSequence() generate a Sequence of N Characters for a Given Specific Case:       Use rand() for generating random indexes.       Store the first character directly into the ... Read More

How to get the primary key “column name” of a specific table in MySQL?

George John
Answered on 3rd May, 2019

Let us first create a table wherein we have a Primary Key CustomerId −mysql> create table DemoTable    (    CustomerId int NOT NULL AUTO_INCREMENT,    CustomerName varchar(20),    CustomerAge int,    CustomerCountryName varchar(100),    PRIMARY KEY(CustomerId)    ); Query OK, 0 rows affected (0.94 sec)Following is the query to ... Read More

Convert MM/DD/YY to Unix timestamp in MySQL?

Chandu yadav
Answered on 3rd May, 2019

To convert MM/DD/YY to UNIX timestamp, you can use the below syntax −select UNIX_TIMESTAMP(str_to_date(yourColumnName, '%m/%d/%Y')) from yourTableName;Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    dateConvertToUnix varchar(100)    ); Query OK, 0 rows affected (0.58 sec)Insert some records ... Read More

How to apply Substring() for fields in MySQL to get part of string?

Ankith Reddy
Answered on 3rd May, 2019

You can use substring() for fields in MySQL to get part of string. Following is the syntax −select substring(yourColumnName, yourStartingIndex, yourEndingIndex) from yourTableName;Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Title longtext    ); Query OK, 0 ... Read More

Problem using the column name 'from' in a MySQL query?

George John
Answered on 3rd May, 2019

You cannot use ‘from’ as column name directly because ‘from’ is a reserved word in MySQL.If you want to still use it, then you need to use the backtick symbol.Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,   ... Read More

How to concatenate all columns in MySQL?

Maheshwari Thakur
Answered on 3rd May, 2019

First, you need to know how many columns are present in a table. Following is the syntax to know the column names −show columns from yourTableName;Following is the syntax to concatenate all columns −select concat(yourColumnName1, yourColumnName2, yourColumnName3, ........N) from yourTableName;Let us first create a table −mysql> create table DemoTable   ... Read More

Get MAX and MIN values along with their row id in MySQL?

Ankith Reddy
Answered on 3rd May, 2019

You can use aggregate function MAX() and MIN() for this.Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Number1 int,    Number2 int    ); Query OK, 0 rows affected (0.89 sec)Insert records in the table using insert ... Read More

How can I modify an existing column's data type?

George John
Answered on 3rd May, 2019

To modify an existing column’s data type, you can use MODIFY. Let us first create a table −mysql> create table DemoTable    (    ClientId varchar(100),    ClientName varchar(100),    ClientAge int,    ClientProjectDeadline timestamp,    ClientCountryName varchar(100),    isMarried boolean,    ClientNumber bigint    ); Query OK, 0 rows ... Read More

How to update all dates in a Table?

Maheshwari Thakur
Answered on 3rd May, 2019

You can use UPDATE with DATE_ADD() to update all dates. Let us first create a table −mysql> create table DemoTable    (    ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ClientProjectDueDate date    ); Query OK, 0 rows affected (1.19 sec)Insert records in the table using insert command −mysql> ... Read More

MySQL query to count frequency of students with the same age?

Maheshwari Thakur
Answered on 3rd May, 2019

You can use COUNT(*) along with GROUP BY for this. Let us first create a table −mysql> create table DemoTable    (    StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    StudentAge int    ); Query OK, 0 rows affected (0.59 sec)Insert records in the table using insert command −mysql> ... Read More

Order by selected record in MySQL?

Ankith Reddy
Answered on 3rd May, 2019

You can use a CASE statement for this. Let us first create a table −mysql> create table DemoTable    (    Number int    ); Query OK, 0 rows affected (0.71 sec)Insert records in the table using insert command −mysql> insert into DemoTable values(490); Query OK, 1 row affected (0.35 ... Read More

MySQL order from a different starting value?

George John
Answered on 3rd May, 2019

Let us first create a table −mysql> create table DemoTable    (    ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ClientName varchar(30)    ); Query OK, 0 rows affected (0.74 sec)Insert records in the table using insert command −mysql> insert into DemoTable(ClientName) values('John'); Query OK, 1 row affected (0.20 ... Read More

Create index on create table in MySQL?

Chandu yadav
Answered on 3rd May, 2019

Let us first create a table and index −mysql> create table DemoTable    (    StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    StudentFirstName varchar(20),    StudentAge int,    StudentCountryName varchar(100),    INDEX first_Name_index(StudentFirstName)    ); Query OK, 0 rows affected (1.01 sec)Check the description of the table −mysql> desc ... Read More

Advertisements
Loading...
Unanswered Questions View All

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.