- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
To update all the values in a column to John1, John2, etc.; you need to set incremental values 1, 2, 3, etc. and concatenate them to the records. Let us first create a table −mysql> create table DemoTable ( StudentId varchar(80) ); Query OK, 0 rows affected (0.50 sec)Insert some records in the table using insert command. Here, for our example, we have set similar names −mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable values('John'); Query OK, 1 row ... Read More
The matrix probability question Calculates the probability that whether an element will be inside the given matrix after taking N steps and any direction. This means we need to find what is the probability of an element not going out of the scope of the matrix even after moving N positions in any direction.In this problem, we are free to move the matrix element in all four directions (left, right, up, down). And the probability of moving elements is same 0.25 or 1/4.The program will return 0 if the element steps out otherwise not.Example Live Demo#include int isSafe(int x, int ... Read More
For this, you can use LIKE operator. Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Name varchar(40), BornMonth varchar(40) ); Query OK, 0 rows affected (0.47 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Name, BornMonth) values('Chris', 'MONTH_DEC'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable(Name, BornMonth) values('Bob', 'MONTH_JAN'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable(Name, BornMonth) values('Mike', 'MONTH_FEB'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable(Name, BornMonth) values('David', 'MONTH_JAN'); Query OK, 1 ... Read More
_Generic keyword in C is used to define MACRO for different data types. This new keyword was added to the C programming language in C11 standard release. the _Generic keyword is used to help the programmer use the MACRO in a more efficient way.this keyword translate the MACRO based on the type of the variable. let's take an example ,#define dec(x) _Generic((x), long double : decl, \ default : Inc , \ float: incf )(x)The above syntax is how to declare any MACRO as generic for different methods.Let's take an example code, this code will define a MACRO that will ... Read More
The UPDATE command is used in MySQL to update records. With it, the SET command is used to set new values. Let us first create a table −mysql> create table DemoTable ( EmployeeId int NOT NULL AUTO_INCREMENT PRIMARY KEY, EmployeeName varchar(50), EmployeeSalary int ); Query OK, 0 rows affected (0.57 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(EmployeeName, EmployeeSalary) values('Chris', 56780); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable(EmployeeName, EmployeeSalary) values('Robert', 45670); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable(EmployeeName, EmployeeSalary) values('Mike', 87654); Query OK, 1 ... Read More
In C++ 17, there are introduced two new ways by which a programmer can assign values to a variable or declared them. In this update, elser then the classical way of assigning values to a variable the following two ways to initialise values.Classical methodInitially the assignment operator ‘=’ is used for assignment and declaration of a variable. assignment of a variable using = looks like, datatype variable_name = value;Example, int val = 243;New methodUniform initialisationIn uniform initialisation of variables we do not use the ‘=’ operator. the value is enclosed inside a pair of curly braces ' {} '. Value ... Read More
In MySQL, SERIAL is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE. So, do not use NOT NULL after SERIAL, since it already includes NOT NULL as part of its definition.Let us see an example and create a table. Here, we have a column with the name “serial” −mysql> create table DemoTable ( Id serial ); Query OK, 0 rows affected (0.42 sec)Insert some records in the table using insert command. We aren’t including any value while inserting −mysql> insert into DemoTable values(); Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable values(); Query OK, 1 ... Read More
To get the nth highest value in a column, you can use LIMIT OFFSET. Here, OFFSET is used to skip the values. Let us first create a table −mysql> create table DemoTable ( Value int ) ; Query OK, 0 rows affected (0.49 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(100); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values(140); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(90); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable values(80); Query OK, 1 row affected (0.09 ... Read More
An adapter pattern is used to convert the interface of a class into an interface that is expected by the client. An adapter helps the programmer to make its classes work together and make sure the user requirement is fulfilled by making incompatible interfaces completable.let's understand a bit more about the adapter pattern. The concept of adapter is taken from the real world. as in the real world We use adapters to connect things that are incompatible with each other. let's take an example, in modern day smartphones the 3.5 mm jack for earphones is missing, so the brands have ... Read More
To delete, use MySQL DELETE. However, to get records older than 14 days, subtract the current date with date interval of 14 days. The syntax for the same is shown below −delete from yourTableName where yourColumnName< (curdate() - interval 14 day);Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, DueDate date ); Query OK, 0 rows affected (0.50 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(DueDate) values('2019-08-20'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable(DueDate) values('2019-08-19'); Query OK, 1 row affected ... Read More
To Continue Learning Please Login
Login with Google