AmitDiwan has Published 10740 Articles

Char Struct in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:26:39

432 Views

The Char Struct in C# represents a character as a UTF-16 code unit. Here are some of the methods −MethodDescriptionConvertToUtf32(Char, Char)Converts the value of a UTF-16 encoded surrogate pair into a Unicode code point.ConvertToUtf32(String, Int32)Converts the value of a UTF-16 encoded character or surrogate pair at a specified position in ... Read More

Take all records from one MySQL table and insert it to another?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:25:16

192 Views

For this, you can use the concept of CREATE TABLE AS SELECT statement. Let us first create a table −mysql> create table DemoTable1518    -> (    -> EmployeeId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> EmployeeName varchar(20)    -> )AUTO_INCREMENT=101; Query OK, 0 rows affected (0.69 sec)Insert some ... Read More

Getting the Standard Output and Standard Error Output Stream through Console in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:24:33

681 Views

To get the standard output stream through Console, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(string[] args){       Console.WriteLine("Standard Output Stream = "+Console.Out);    } }OutputThis will produce the following output −Standard Output Stream = System.IO.TextWriter+SyncTextWriterExampleTo get the standard ... Read More

How do I select data from one table only where column values from that table match the column values of another table in MySQL?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:23:25

4K+ Views

For this, you can use subquery along with EXISTS. Let us first create a table −mysql> create table DemoTable1    -> (    -> Id int,    -> SubjectName varchar(20)    -> ); Query OK, 0 rows affected (0.58 sec)Insert some records in the table using insert command −mysql> insert ... Read More

Counting with condition in MySQL?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:19:44

1K+ Views

To count, use aggregate function SUM() and to count with condition, you need to set the condition with WHERE. Let us first create a table −mysql> create table DemoTable1515    -> (    -> ClientId varchar(10),    -> ClientName varchar(20)    -> ); Query OK, 0 rows affected (0.53 sec)Insert ... Read More

MySQL query to select rows one batch at a time

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:15:48

3K+ Views

For this, you can use the concept of LIMIT and OFFSET. Let us first create a table −mysql> create table DemoTable1514    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> FirstName varchar(20)    -> ); Query OK, 0 rows affected (0.63 sec)Insert some records in ... Read More

When inserting a new row, should I include the columns that are null in the MySQL query?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:14:44

154 Views

If you do not specify the column list in insert statement then you can use below syntax −insert into yourTableName values(NULL, yourValue, NULL, NULL, .....N);Let us first create a table −mysql> create table DemoTable1513    -> (    -> StudentId int,    -> StudentName varchar(20) ,    -> StudentAge int, ... Read More

How do I detect if the ON UPDATE event fired with query in MySQL?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:12:41

231 Views

You can detect with the help of row_count(). If the row_count() returns 1 that means it is a new record. If it returns 2, that means the ON UPDATE event is fired with query. Following is the syntax −select row_count();Let us first create a table −mysql> create table DemoTable1512   ... Read More

How to prevent MySQL GROUP BY from collapsing NULL values into a single row?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:11:19

1K+ Views

Fir this, you can use IFNULL() along with ORDER BY clause. Let us first create a table table −mysql> create table DemoTable1511    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> FirstName varchar(20)    -> ); Query OK, 0 rows affected (1.97 sec)Insert some records ... Read More

MySQL query to count comma’s from field value?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:10:11

257 Views

Following is the syntax −select length(yourColumnName) - length(replace(yourColumnName, ', ', '')) as anyAliasName from yourTableName;Let us first create a table −mysql> create table DemoTable1510    -> (    -> Value varchar(50)    -> ); Query OK, 0 rows affected (6.75 sec)Insert some records in the table using insert command −mysql> ... Read More

Advertisements