Default Access for a Class in C#

Samual Sam
Updated on 20-Jun-2020 13:08:55

1K+ Views

If no access modifier is specified, then the default is Internal. Internal access specifier allows a class to expose its member variables and member functions to other functions and objects in the current assembly. In other words, any member with internal access specifier can be accessed from any class or method defined within the application in which the member is defined.The following is an example showing the usage of Internal access specifier −Example Live Demousing System; namespace RectangleApplication {    class Rectangle {       //member variables       internal double length;       internal double width; ... Read More

Get List of Columns from Current Database Table

Prabhas
Updated on 20-Jun-2020 13:07:19

150 Views

It can be done with the SHOW COLUMNS statement. Its Syntax would be as follows −SyntaxSHOW COLUMNS FROM tab_nameHere tab_name is the name of the table from which we want to see the list of columns.ExampleIn the example we are getting the list of columns from a table named Student_info −mysql> SHOW COLUMNS FROM Student_info\G *************************** 1. row ***************************   Field: studentid    Type: int(11)    Null: YES     Key: Default: NULL   Extra: *************************** 2. row ***************************   Field: Name    Type: varchar(40)    Null: YES     Key: Default: NULL   Extra: *************************** 3. row ***************************   ... Read More

MySQL Operator Precedence and Its Effect on Result Set

Vikyath Ram
Updated on 20-Jun-2020 13:05:49

274 Views

MySQL follows operator precedence and it has the following list of operators, having the same precedence which is on the same line −INTERVAL BINARY, COLLATE ! - (unary minus), ~ (unary bit inversion) ^ *, /, DIV, %, MOD -, + & | =, , >=, >,

Stuff a String with Another Using MySQL Functions

Paul Richard
Updated on 20-Jun-2020 13:05:02

386 Views

MySQL have two functions namely LPAD() and RPAD() with the help of which we can stuff a string with another string.LPAD() function, as the name suggests, left stuff a string with another string. Following is the syntax for using it in MySQL −SyntaxLPAD(original_string, @length, pad_string)Here,  original_string is the string in which we stuff another string.@length is the total length of string returned after stuffing.Pad_string is the string which is to be stuffed with original_string.Examplemysql> SELECT LPAD('tutorialspoint', 18, 'www.'); +----------------------------------+ | LPAD('tutorialspoint', 18, 'www.') | +----------------------------------+ | www.tutorialspoint               | +----------------------------------+ 1 row in set ... Read More

Check for NULL in a MySQL Query

Kumar Varma
Updated on 20-Jun-2020 13:03:23

291 Views

With the help of IS NULL operator, we can check for NULL in a MySQL query. We cannot use = (comparison operator) because as we know that NULL is not a value. Following example using the data from ‘employee’ table will exhibit it −Examplemysql> Select * from Employee WHERE Salary IS NULL; +----+-------+--------+ | ID | Name  | Salary | +----+-------+--------+ | 7  | Aryan | NULL   | | 8  | Vinay | NULL   | +----+-------+--------+ 2 rows in set (0.00 sec)The query above use IS NULL operator and produces the output where salary column is having NULL.mysql> ... Read More

Use RAND Function in ORDER BY Clause to Shuffle MySQL Rows

Paul Richard
Updated on 20-Jun-2020 13:02:41

486 Views

When we use MySQL ORDER BY clause with RAND() function then the result set would have the shuffled set of rows. In other words, the result set would be in a random order. To understand it considers a table ‘Employee’ having the following records −mysql> Select * from employee; +----+--------+--------+ | ID | Name   | Salary | +----+--------+--------+ | 1  | Gaurav | 50000  | | 2  | Rahul  | 20000  | | 3  | Advik  | 25000  | | 4  | Aarav  | 65000  | | 5  | Ram    | 20000  | | 6  | Mohan  | ... Read More

Generate Same Sequence of Random Numbers in MySQL

Vikyath Ram
Updated on 20-Jun-2020 13:01:46

286 Views

When invoked with an integer argument, RAND( ) uses that value to seed the random number generator. Each time you seed the generator with a given value, RAND( ) will produce the same sequence of random numbers. Following example will demonstrate it −Examplemysql> Select RAND(1), RAND(1), Rand(1); +---------------------+---------------------+---------------------+ | RAND(1)             | RAND(1)             | Rand(1)             | +---------------------+---------------------+---------------------+ | 0.40540353712197724 | 0.40540353712197724 | 0.40540353712197724 | +---------------------+---------------------+---------------------+ 1 row in set (0.00 sec)

Use IFNULL Function Instead of COALESCE in MySQL

karthikeya Boyini
Updated on 20-Jun-2020 13:00:17

2K+ Views

As we know that IFNULL() function will return the first argument if it is not NULL otherwise it returns the second argument. On the other hand, COALESCE() function will return first non-NULL argument. Actually, both IFNULL() and COALESCE() functions in MySQL works equivalently if the number of arguments is two only. The reason behind this is that IFNULL() function accepts only two arguments and in contrast, COALESCSE() function can accept any number of arguments.Suppose if we want to use IFNULL() function at the place of COALESCE() function then the number of arguments must be two. Following example will demonstrate it ... Read More

Check MySQL Tables in a Different Database Using IN Operator

seetha
Updated on 20-Jun-2020 12:59:46

139 Views

It can be done with the SHOW FULL TABLES statement. Its Syntax would be as follows −SyntaxSHOW FULL TABLES IN db_nameHere db_name is the name of the database from which we want to see the list of tables.ExampleWe are currently using the database named ‘query’ and the MySQL query below will show us the list of tables along with table type from the database named mysql.mysql> SHOW FULL TABLES IN mysql; +---------------------------+------------+ | Tables_in_mysql           | Table_type | +---------------------------+------------+ | arena                     | BASE TABLE | | ... Read More

Insert Value in Column Using MySQL COALESCE Function

Swarali Sree
Updated on 20-Jun-2020 12:59:12

859 Views

To understand it, we are using the data from the table ‘Employee’ having Salary=NULL for ID = 5 and 6, as follows −mysql> Select * from Employee; +----+--------+--------+ | ID | Name   | Salary | +----+--------+--------+ | 1  | Gaurav | 50000  | | 2  | Rahul  | 20000  | | 3  | Advik  | 25000  | | 4  | Aarav  | 65000  | | 5  | Ram    | NULL   | | 6  | Mohan  | NULL   | +----+--------+--------+ 6 rows in set (0.00 sec)Now, the following queries will use COALESCE() function along with UPDATE and ... Read More

Advertisements