What is the difference between JavaScript and C++?

Sreemaha
Updated on 30-Sep-2019 07:06:17

2K+ Views

The following are the differences between JavaScript and C++.JavaScript is a lightweight, interpreted programming language. It is designed for creating network-centric applications. It is complementary to and integrated with Java. JavaScript is very easy to implement because it is integrated with HTML. It is open and cross-platform.C++ is a middle-level programming language developed by Bjarne Stroustrup starting in 1979 at Bell Labs. It runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.JavaScript is a scripting whereas C++ is a programming language.C++ program is to be compiled and executed, whereas a script in ... Read More

MySQL multiple COUNT with multiple columns?

AmitDiwan
Updated on 30-Sep-2019 07:05:35

268 Views

You can use an aggregate function SUM() along with IF(). Let us first create a table −mysql> create table DemoTable (    FirstName varchar(100),    LastName varchar(100) ); Query OK, 0 rows affected (2.80 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Adam', 'Smith'); Query OK, 1 row affected (0.25 sec) mysql> insert into DemoTable values('John', 'Smith'); Query OK, 1 row affected (0.36 sec) mysql> insert into DemoTable values('John', 'Doe'); Query OK, 1 row affected (1.38 sec) mysql> insert into DemoTable values('Bob', 'Doe'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values('Sam', ... Read More

Use LIKE % to fetch multiple values in a single MySQL query

AmitDiwan
Updated on 30-Sep-2019 07:00:04

3K+ Views

To fetch multiple values wit LIKE, use the LIKE operator along with OR operator. Let us first create a table −mysql> create table DemoTable1027 (    Id int,    Name varchar(100) ); Query OK, 0 rows affected (1.64 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1027 values(100, 'John'); Query OK, 1 row affected (0.72 sec) mysql> insert into DemoTable1027 values(20, 'Chris'); Query OK, 1 row affected (0.56 sec) mysql> insert into DemoTable1027 values(200, 'Robert'); Query OK, 1 row affected (0.84 sec) mysql> insert into DemoTable1027 values(400, 'Mike'); Query OK, 1 row affected (0.47 sec)Display all ... Read More

What does the leading semicolon in JavaScript libraries do?

mkotla
Updated on 30-Sep-2019 06:59:03

211 Views

A function in JavaScript looks like the following:(function(){...})()A library in JavaScript shows a function, which begins with a semicolon, for example:;(function ) { }The semicolon allows to safely concatenate several JS files into one. This is to serve it faster as one HTTP request.A leading semicolon can also be to protect from preceding code, which may have been improperly closed. A semicolon will definitely prevent this from happening.

What is the difference between a method and a function?

seetha
Updated on 30-Sep-2019 06:57:27

6K+ Views

Method and a function are the same, with different terms. A method is a procedure or function in object-oriented programming.A function is a group of reusable code which can be called anywhere in your program. This eliminates the need for writing the same code again and again. It helps programmers in writing modular codes.The following is the syntax of a JavaScript function:     Here’s an example:    

MySQL select query to fetch data with null value?

AmitDiwan
Updated on 30-Sep-2019 06:57:06

376 Views

Let us first create a table −mysql> create table DemoTable (    CustomerName varchar(100),    CustomerCountryName varchar(100) ); Query OK, 0 rows affected (0.95 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris', 'US'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('Bob', 'UK'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('Carol', NULL); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('David', 'AUS'); Query OK, 1 row affected (0.32 sec) mysql> insert into DemoTable values('Mike', NULL); Query OK, 1 row affected (0.18 sec)Display all records ... Read More

Show column value twice in MySQL Select?

AmitDiwan
Updated on 30-Sep-2019 06:54:42

203 Views

You can use concat(). Let us first create a table −mysql> create table DemoTable (    Value int ); Query OK, 0 rows affected (0.73 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(100); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values(200); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable values(100); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values(200); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values(200); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values(100); Query ... Read More

Get count of zeros for columns values declared with INT type in MySQL

AmitDiwan
Updated on 30-Sep-2019 06:52:26

171 Views

For this, you can use LENGTH() along with REPLACE(). Let us first create a table −mysql> create table DemoTable (    Value int ); Query OK, 0 rows affected (1.22 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(10002000); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values(00000); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values(400560); Query OK, 1 row affected (0.19 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+----------+ | Value    | +----------+ | 10002000 ... Read More

How to parse a string to float or int in python?

Rajendra Dharmkar
Updated on 30-Sep-2019 06:50:30

160 Views

To parse a string to int, you can use the following:try:     print int('112') except ValueError:     print 'Cannot parse'This will give you the output:112To parse a string to float, you can use the following:try:     print float('112.15') except ValueError:     print 'Cannot parse'This will give you the output:112.15

Return value from a row if it is NOT NULL, else return the other row value in another column with MySQL

AmitDiwan
Updated on 30-Sep-2019 06:50:15

188 Views

For this, you can use IFNULL(). Let us first create a table −mysql> create table DemoTable (    FirstName varchar(100),    LastName varchar(100) ); Query OK, 0 rows affected (0.62 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('John', 'Doe'); Query OK, 1 row affected (0.29 sec) mysql> insert into DemoTable values(NULL, 'Taylor'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('David', NULL); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values(NULL, 'Miller'); Query OK, 1 row affected (0.12 sec)Display all records from the table using select statement −mysql> ... Read More

Advertisements