Arjun Thakur has Published 1109 Articles

Initialization of global and static variables in C

Arjun Thakur

Arjun Thakur

Updated on 26-Jun-2020 13:45:22

4K+ Views

In C language both the global and static variables must be initialized with constant values. This is because the values of these variables must be known before the execution starts. An error will be generated if the constant values are not provided for global and static variables.A program that demonstrates ... Read More

When are static C++ class members initialized?

Arjun Thakur

Arjun Thakur

Updated on 26-Jun-2020 13:41:03

382 Views

Static C++ class members can be defined using the static keyword. The static member in a class is shared by all the class objects as there is only one copy of the static class member in the memory, regardless of the number of objects of the class.The static class member ... Read More

What is the lifetime of a static variable in a C++ function?

Arjun Thakur

Arjun Thakur

Updated on 26-Jun-2020 13:35:45

16K+ Views

A static variable is a variable that is declared using the keyword static. The space for the static variable is allocated only one time and this is used for the entirety of the program.Once this variable is declared, it exists till the program executes. So, the lifetime of a static ... Read More

Private and Protected Members in C++

Arjun Thakur

Arjun Thakur

Updated on 26-Jun-2020 13:29:23

8K+ Views

A class in C++ has public, private and protected sections which contain the corresponding class members.The private data members cannot be accessed from outside the class. They can only be accessed by class or friend functions. All the class members are private by default.The protected members in a class are ... Read More

What are Error-Detecting Codes?

Arjun Thakur

Arjun Thakur

Updated on 26-Jun-2020 13:14:55

19K+ Views

Error-detecting codes are a sequence of numbers generated by specific procedures for detecting errors in data that has been transmitted over computer networks.When bits are transmitted over the computer network, they are subject to get corrupted due to interference and network problems. The corrupted bits leads to spurious data being ... Read More

How to create a MySQL table with InnoDB engine table?

Arjun Thakur

Arjun Thakur

Updated on 26-Jun-2020 13:14:54

934 Views

To create a table with InnoDB engine, we can use the ENGINE command. Here is the query to create a table.mysql> create table EmployeeRecords - > ( - > EmpId int, - > EmpName varchar(100), - > EmpAge int, - > EmpSalary float - > )ENGINE=INNODB; Query OK, 0 rows ... Read More

MySQL SELECT last few days?

Arjun Thakur

Arjun Thakur

Updated on 26-Jun-2020 13:14:03

603 Views

To select last few days, use DATE_ADD() function in MySQL. The syntax is as follows −select date_add(curdate(), interval - anyIntgegerValue day);Or you can DATE_SUB() from MySQL.select date_sub(curdate(), interval anyIntgegerValue day);Or you can use the following syntax −select curdate() - interval anyIntgegerValue day;Here is the example of all syntaxes shown above ... Read More

How to check if field is null or empty in MySQL?

Arjun Thakur

Arjun Thakur

Updated on 26-Jun-2020 13:10:51

3K+ Views

To check whether a field is null or empty in MySQL, use the IF() function in MySQL. The syntax is as follows −SELECT IF(yourColumnName IS NULL or yourColumnName = '', 'NULLId', yourColumnName) as anyVariableName from yourTableName;To understand the above syntax, let us create a table. The following is the query ... Read More

Simulating MySQL's ORDER BY FIELD() in PostgreSQL?

Arjun Thakur

Arjun Thakur

Updated on 26-Jun-2020 12:53:09

301 Views

The following is the process to simulate MySQL’s ORDER BY FIELD() in PostgreSQL.We have used an Online Compiler to run PostgreSQL.Let us now see what we did above to get the output.Firstly, we created a table.create table PostgreOrderIdDemo (    countryName varchar(20) );Inserted records with the help of INSERT command.insert ... Read More

Show constraints on table command in MySQL?

Arjun Thakur

Arjun Thakur

Updated on 26-Jun-2020 12:44:26

1K+ Views

You can show constraints on tables with the help of SHOW command. The syntax is as follows −show create table yourTableName;The above command will show all constraints with table ENGINE. Using this, you can even see all the column names and corresponding data types.To understand the above MySQL statement, let ... Read More

Advertisements