Disks are the mainly used mass storage devices. They provide the bulk of secondary storage in operating systems today.Disk StructureEach modern disk contains concentric tracks and each track is divided into multiple sectors. The disks are usually arranged as a one dimensional array of blocks, where blocks are the smallest storage unit.Blocks can also be called as sectors. For each surface of the disk, there is a read/write desk available. The same tracks on all the surfaces is known as a cylinder.Disk SchedulingThere are many disk scheduling algorithms that provide the total head movement for various requests to the disk. ... Read More
HashMap is in Java, not C#. The equivalent of HashMap in C# is Dictionary that is used as a collection of key-value pair.Firstly, set the Dictionary −Dictionary d = new Dictionary(); d.Add("soccer", 1); d.Add("cricket", 2); d.Add("tennis", 3); d.Add("rugby", 4);Now get the keys and sort them using ToList() and Sort() method respectively.// get keys var val = d.Keys.ToList(); // sort val.Sort();The following is the complete example to sort a HashMap according to keys −Exampleusing System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { Dictionary d = new Dictionary() ... Read More
For combining ROW selection with COLUMN selection, we can use the ‘WHERE’ clause. For example, we have a table below −mysql> Select * from Student; +--------+--------+--------+ | Name | RollNo | Grade | +--------+--------+--------+ | Gaurav | 100 | B.tech | | Aarav | 150 | M.SC | | Aryan | 165 | M.tech | +--------+--------+--------+ 3 rows in set (0.00 sec)Now, the following query will show how we can combine ROW selection with COLUMN selection using WHERE clause.mysql> Select Name, RollNo, Grade from Student where Grade='M.Sc' or Grade='B.Tech'; +--------+--------+--------+ | Name | RollNo ... Read More
Chained Exceptions are a chain of try-catch statements that handle exceptions. To create a chain of exceptions i.e. chained exceptions −Set the first try-catch −Examplestatic void Main(string[] args) { try { One(); } catch (Exception e) { Console.WriteLine(e); } }Now try-catch under method One() −Examplestatic void One() { try { Two(); } catch (Exception e) { throw new Exception("First exception!", e); } }The method Two() also continues chained exception.Examplestatic void Two() { try { Three(); } catch ... Read More
LOAD DATAThis statement is used for importing the data from data files into our database. It reads data records directly from a file and inserts them into a table. Its syntax would be as follows −SyntaxLOAD DATA LOCAL INFILE '[path/][file_name]' INTO TABLE [table_name ];Here, a path is the address of the file.file_name is the name of the .txt filetable_name is the table where the data will be loaded.To illustrate the concept we are having the following data, separated by tab, in ‘A.txt’ whose path is d:/A.txt −100 John USA 10000 101 Paul UK 12000 102 Henry NZ 11000 103 Rick ... Read More
The DESCRIBE statement gives information about MySQL table’s structure.ExampleConsider the constructing of the following table name ‘Employee’ with Create Table statement as follows −mysql> Create table Employee(ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT, Name Varchar(20)); Query OK, 0 rows affected (0.20 sec)Now with the help of ‘DESCRIBE Employee‘ statement, we can get the information about the employee table.mysql> Describe Employee; +-------+-------------+------+-----+---------+------------------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+------------------+ | ID | int(11) | NO | PRI | NULL | auto_increment ... Read More
The subquery can return at most one value. The value can be the result of an arithmetic expression or a column function. MySQL then compares the value that results from the subquery with the value on the other side of the comparison operator. MySQL subquery can be used before or after any of the comparison operators like =, >, >=,
A subquery that contains a reference to a table that also appears in the outer query is called a correlated subquery. In this case, MySQL evaluates from inner query to the outer query. To understand it we are having the following data from table ‘cars’ −mysql> Select * from Cars; +------+--------------+---------+ | ID | Name | Price | +------+--------------+---------+ | 1 | Nexa | 750000 | | 2 | Maruti Swift | 450000 | | 3 | BMW | 4450000 | | 4 ... Read More
To understand how to call Math Operations using Delegates in C#, let us see an example wherein we will divide a number.We have a class and a function in it −public class Demo { public static double DivideFunc(double value) { return value / 5; } }Now, our delegate −delegate double myDelegate(double x);Set a value and call −myDelegate[] val = { Demo.DivideFunc }; result(val[0], 20);Math operation is called using delegate −static void result(myDelegate d, double value) { double result = d(value); Console.WriteLine("Result = {0}", result); }The above displays the following result for “value/ 5” i.e. 20/5 −Result = 4
The default sort order in MySQL tables is ascending. Whenever we use ORDER BY clause to sort out the rows of a table, MySQL gives output in ascending order, with the smallest value first. Consider the following example from a table named ‘student’ −mysql> Select * from student order by name; +--------+--------+--------+ | Name | RollNo | Grade | +--------+--------+--------+ | Aarav | 150 | M.SC | | Aryan | 165 | M.tech | | Gaurav | 100 | B.tech | +--------+--------+--------+ 3 rows in set (0.00 sec)We can see the query above gives the output, ordered by name, in ascending order, start with smallest value ‘Name’ column.
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP