OyeWiki - Gain the Knowledge that you need

Videos | Articles

MYSQL Clone Table

Category : MYSQL Author : Ankur Rastogi Date : Sat Jun 04 2016

Overview MYSQL Clone Tables can be referred as exact replica of an existing table. And to perform certain operations which you can not apply on original table as it is currenlty used by lot of enitities. For this purpose you can create a clone table of the exisitng table. There are various ways to create clone table. One way of creating a clone table is to use CREATE TABLE AS SELECT command Syntax Syntax for creating a clone table by this way is CREATE TABLE table_name AS...

Read Full

Linux and Unix Chown Command

Category : LINUX Author : Ankur Rastogi Date : Sun Apr 17 2016

Overview Linux CHOWN command is used to change the owner or/and group of any file or directory. Linux Chown command has the capability to define ownership of any file or directory. Some interesting usage of Linux CHOWN command is  If only owner is provided with CHOWN command than only owner of the file is changes without changing the group of the file. To change both owner as well as group of the file, we need to provide owner and group separated by colon. If only colon group name...

Read Full

SQL Full Join

Category : SQL Author : Ankur Rastogi Date : Fri Mar 25 2016

Overview SQL Full Join will return combination of rows from both the tables on the basis of common field by filling NULL values on non matching rows. Full Join will basically give you a combination of both the tables. Syntax Syntax for Full Join is: SELECT left_table.column, right_table.column FROM left_table FULL JOIN right_table ON left_table.field = right_table.field; Examples Let us have a look with the help of following table i) hostel_list containing list of hostels....

Read Full

Web Server vs Application Server Difference Explained

Category : IQ Author : Ankur Rastogi Date : Sun Nov 06 2016

Web servers are used to server static content over the http request. while application servers are used to serve dynamic content over variety of requests. Web servers also act as protecting container to the application server, restricting direct access to the application server by the client. In this the port on which web server is running is accessible from outside, whereas access to port on which application server is closed and client can only contact web server thus...

Read Full

SQL Joins

Category : SQL Author : Ankur Rastogi Date : Wed Mar 23 2016

Overview SQL joins are used to combine data from two or more database tables on the basis of some common value in the tables. We apply joins by passing where conditions so we can use all the operators applicable with where clause like < , > , <=, >=, !=, <>, between, like, Not, = and lot more. Here we will be explaining 5 types of joins in next few articles SQL Inner Join SQL Left Join SQL Right Join SQL Full Join SQL Self Join SQL Cartesian Join...

Read Full

MYSQL LCASE Function

Category : MYSQL Author : Ankur Rastogi Date : Sat Jun 04 2016

Overview MYSQL LCASE() function is used to return the column value in lower case while fetching data from database. LCASE function will return only input column in lower case not all columns in that table.  Suppose you have to show values from some column in lowercase to user despite of type of case of values store in any particular column, so in that case you have two options either you will fetch data from db and than will convert it to lowercase in your business logic or You...

Read Full

SQL Alter Table

Category : SQL Author : Ankur Rastogi Date : Sun Mar 27 2016

Overview SQL Alter table is used to update the database table structure of an existing table. Alter table command can add, delete or modify any of the column in an exisitng table. Lot of time we get a requirement to either add a new column, delete an existing column or change the name, place, data type or data a column can hold, In all such requirement we can use SQL Alter statement. Syntax for SQL Alter statement for add, drop and modify a column is mentioned below in their...

Read Full

Linux and Unix Uptime Command

Category : LINUX Author : Ankur Rastogi Date : Sun Apr 17 2016

Overview Linux Uptime Command is used to tell from how long the system has been running. As per linux manual uptime gives a one line display of the following information. The current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes. This is the same information contained in the header line displayed by w. System load averages is the average number of processes that are...

Read Full

SQL Drop Table

Category : SQL Author : Ankur Rastogi Date : Fri Mar 18 2016

Overview To remove/delete a sql table from database we use DROP command. Syntax Syntax for dropping a table is  DROP TABLE table_name; Example For ex. If we want to drop abc table create in last step . Than the sql query will be DROP TABLE abc;...

Read Full

Find the name of the hostel which has second highest capacity from hostel_list table

Category : IQ Author : Ankur Rastogi Date : Fri Aug 05 2016

Problem Overview Suppose we have a table hostel_list   - List of hostels +----+-------------------+-----------+----------+ | id | name | occupancy | capacity | +----+-------------------+-----------+----------+ |  1 | ASHOK BHAVAN | 2 | 1090 | |  2 | KAILASH BHAVAN | 2 | 990 | |  3 | RUDRAKSH BHAVAN | 2 | 990 | |  4 | KAVERI BHAVAN | 1 | 690 | |  5 | BHAGIRATHI BHAVAN | 4 | 2140 | |  6 |...

Read Full

SQL Like Clause

Category : SQL Author : Ankur Rastogi Date : Tue Mar 22 2016

Overview Like clause is used with Where clause to apply condition. As the name suggests Like clause is used to fetch all the records where a column matches/contains a word. Syntax Syntax for Like clause is SELECT * FROM table_name where column_name LIKE 'random_value'; Example Suppose we need to find all the hostel name which ends with 'SH' like KAILASH BHAVAN is one of them. So the query for this will be SELECT * FROM hostel_list WHERE name LIKE '%SH %'; In the...

Read Full

MYSQL difference between count(*) and count(column_name)

Category : MYSQL Author : Mayank Rastogi Date : Thu Nov 03 2016

Earlier we have published about Mysql Count Function  which is used to return the total number of rows present in any database table. Count function is mainly used where we want to fetch the total number of records in any of the given table. Problem Statement So the question arises is that what is the difference between count(*) and count(column_name)? count(*) count(*) returns the total number of rows in any table irrespective of the values inside the columns. count(column_name) On...

Read Full

SQL Right Join

Category : SQL Author : Ankur Rastogi Date : Thu Mar 24 2016

Overview Right Join as the name suggests it returns all the result from the right table i.e. table 2 and all the rows that matches the ON clause from left table i.e. table 1. So Right Join will return all the rows from right table and it will return either matching rows from left table or null for non matching rows. Even if it will not find any matching rows in left table at all in that case also it will return all the rows from right table. Syntax Syntax for SQL Right Join is...

Read Full

MYSQL Dump - How to take mysql dump or export mysql data

Category : MYSQL Author : Ayush Kush Date : Wed Aug 10 2016

Some times we get a requirement to take mysql dump from remote server to share within our teams or ofter we use to get mysql backup at some regular interval to keep a backup copy of your MYSQL databases. There can be lot more scenarios where we require to take mysql backup. We take this with the help of MYSQLDUMP command. The syntax of mysqldump command is  MYSQLDUMP -u user -p password database_name > file_name.sql  user - User name of the user that...

Read Full

MYSQL Full Join

Category : MYSQL Author : Ankur Rastogi Date : Sat Apr 16 2016

Mysql Full Join Overview SQL Full Join will return combination of rows from both the tables on the basis of common field by filling NULL values on non matching rows. Full Join will basically give you a combination of both the tables. Mysql Full Join Syntax Syntax for Full Join is: SELECT left_table.column, right_table.column FROM left_table FULL JOIN right_table ON left_table.field = right_table.field; Mysql Full Join Example Let us have a look with the help...

Read Full

SQL Wildcards

Category : SQL Author : Ankur Rastogi Date : Sun Mar 27 2016

Overview Special characters are used as wild cards in SQL. SQL Wildcards are used to fetch data from table with the LIKE clause. We can use LIKE clause with wildcards to match substring or string with some pattern in database table. SQL Wildcards are % ==> It matches one or more characters. _ ==> It matches one character. [list_of_characters] ==> In this it applies sets, ranges of string characters. [! or ^list_of_characters] ==> In this this is used to match...

Read Full

MYSQL Union Clause

Category : MYSQL Author : Ankur Rastogi Date : Sat Jun 04 2016

Overview MYSQL Union Operator is used to combine select query result for two or more than two tables. As MYSQL Union Opertor combines result set for two or more than two select fetch statements than all the select statement must have same set of columns, same set of columns in expression, same data types with same or different data length. Union operator is used to select only distinct or unique values in default case. If we want to fetch all the possible Union of select...

Read Full

SQL Sub Queries

Category : SQL Author : Ankur Rastogi Date : Sun Mar 27 2016

SQL sub queries are referred as a subquery within a query. Subquery is used to fetch values and pass in another query as input. In SQL we can write subquery to fetch data and provide that data as input to the other query. Then other query can use that data as a conditions which is provided by subquery. In SQL we can use subquery within queries like INSERT, UPDATE, DELETE and SELECT. A Subquery can also be used wit all the SQL Operators. Often a Subquery is used to provide data to a...

Read Full

SQL Indexes

Category : SQL Author : Ankur Rastogi Date : Sun Mar 27 2016

Overview Indexes helps in faster retrieval of data from database table. Database application uses indexes to retrieve data fast. Indexes are separate tables which are used to lookup on database tables to fetch data faster. Indexes are like index that you have in books. If you want to directly go to any chapter or topic than you search for that topic or chapter in index and directly go to that page. This is how index works. We create lookup tables having pointers to our data in...

Read Full

MYSQL In Clause

Category : MYSQL Author : Ankur Rastogi Date : Sat Apr 16 2016

Overview In clause helps us to apply a range of values or multiple values in a where condition to match with. It is more commonly used when we want to match a column value to any from a group of values. Syntax Syntax for In Clause is SELECT * FROM table_name WHERE column_name in (Val1, Val2, .... ValN); Example Let us consider hostel_list table, which contains the list of hostels with their occupancy and capacity limits....

Read Full

How to use ninject dependency injection in mvc

Category : CSHARP Author : Vipin Joshi Date : Wed Jul 27 2016

Overview While working on MVC application in asp.net sometime we need to inject dependency also know as DI(Dependency Injection). DI is itself a separate topic to study which I left for some other day. Refer here for more info on  DI Dependency Injection According to the wikipedia In  software engineering ,  dependency injection   is a  software design pattern   that implements  inversion of control   for resolving dependencies. A...

Read Full

SQL Update Table

Category : SQL Author : Ankur Rastogi Date : Sun Mar 20 2016

Overview When you are required to update any data in the exisitng table you can use sql update command Syntax Syntax for update data in any table is UPDATE table_name SET col1_name = col1_new_value, col2_name = col2_new_value where [conditions]; Example Let us look into this with the help of an example and consider table hostel_list which contains list of hostels. +----+-------------------+-----------+----------+ | id | name | occupancy | capacity...

Read Full

SQL Use Database

Category : SQL Author : Ankur Rastogi Date : Sun Mar 13 2016

Overview After logging in to database. Before accessing any data or doing any operation, we are required to select a database. which we do using USE command. Syntax Syntax for selecting database is. USE db_name; Example As we have created hostel database in previous step than to start using that database we need to select that database. To select hostel database the command will be. USE hostel. For any reason if hostel database doesn't exist. we will get an error "...

Read Full

अतिथि देवो भवः

Category : TRAVEL Author : Raman Shaily Date : Tue Jul 19 2016

This sentence echos times, we visit any tourist destination as well as hailing from one of the state known Tourism, this is my faith. People across the globe, round the country gives us the opportunity to help them rejuvenate, refresh and peace. Most are with plenty of questions to  be answered by them. We welcome them with open arms and serve in the best manner we can. But my belief and faith in this industry is not so smooth I had encountered many disputes in hospitality...

Read Full

MYSQL UCASE Function

Category : MYSQL Author : Ankur Rastogi Date : Sat Jun 04 2016

MYSQL UCASE() function is used to return the column value in upper case while fetching data from database. UCASE function will return only input column in upper case not all columns in that table. Syntax for UCASE function is SELECT UCASE(column_name) FROM table_name; Let us look more into it with the help of an example Consider table student_list containing details for student. +-----+------------------+--------+-----------+ | sid | name | year | hostel_id...

Read Full

Mysql Create Database

Category : MYSQL Author : Ankur Rastogi Date : Sat Apr 16 2016

Mysql Create Database Overview Create database command is used to create a new database. Admin user rights are required for creating database. Mysql Create Database Syntax The syntax for SQL create database command is CREATE DATABASE db_name; Mysql Create Database Example Say if you want to create a database with name hostel. CREATE DATABASE hostel;...

Read Full

Write a method to generate binary numbers from 1 to n

Category : DATASTRUCTURE Author : Ankur Rastogi Date : Wed May 18 2016

Given a number n, Print all the binary number from 1 to n. Few Examples can be :- 1) n=3 Binary Numbers will be 1 10 11 2) n=7 Binary Numbers will be 1 10 11 100 101 110 111 In a simple way we can also create a decimal to binary method and call that inside a loop from 1 to n. But In this we will be solving this with the help of the Queue Data Structure. To see Queue's Basic Implementation in Javascript read here . Algo for...

Read Full

SQL Drop Database

Category : SQL Author : Ankur Rastogi Date : Sun Mar 13 2016

Overview Drop database command is used to drop an existing database. Admin user rights are required for drop command. Syntax Syntax for SQL drop database command is DROP DATABASE db_name; Example Say if you want to create hostel database that you created in previous step. DROP DATABASE hostel;...

Read Full

SQL LEN Function

Category : SQL Author : Ankur Rastogi Date : Sun Mar 27 2016

SQL LEN Overview SQL LEN Function is used to return length of the input column text value. LEN function does not include spaces that occurs in the start and end of the string. It means that LEN function will first perform trim function to remove spaces and then SQL LEN Function will calculate the length of the string. SQL LEN Syntax SELECT LEN(column_name) FROM table_name WHERE [condition]. SQL LEN Example Let us have a look at an example of SQL LEN function Consider table...

Read Full

SQL NOW Function

Category : SQL Author : Ankur Rastogi Date : Sun Mar 27 2016

SQL NOW Overview SQL NOW Function is used to return system's current data and time. NOW Function will basically returnt the date and time of that system on which you are running on your query. If running on your system then Now will return your system's data and time and if you are running this function on any remote server than Now Function will return remote server's data and time. SQL NOW Syntax Syntax for SQL Now Function is SELECT NOW() FROM table_name; SQL NOW Example...

Read Full

SQL AND & OR Operator

Category : SQL Author : Ankur Rastogi Date : Tue Mar 22 2016

Overview While using where condition in sql query we can use AND and OR operands. Syntax Syntax for using AND and OR operator are SELECT * FROM table_name where [conditions]; Example Let us dig deeper with the help of an example Consider table hostel_list containing list of hostels. +----+-------------------+-----------+----------+ | id | name | occupancy | capacity | +----+-------------------+-----------+----------+ |  1 | ASHOK BHAVAN | 2 |...

Read Full

Linux and Unix Chmod Command

Category : LINUX Author : Ankur Rastogi Date : Sun Apr 17 2016

Overview Before describing CHMOD Command let us understand a little about the files, how they are structured in linux and who all can access it and what type of access users have on these files. For this we require to use Linux LS command . LS -l Suppose it prints drwxr-xr-x 18 ankur staff 612 Jun 22 09:21 abcDir In this we can break it into several parts. So let us have a look on them drwxr-xr-x It denotes the type directory or file and also denotes what type...

Read Full

Binary Search Tree Insert node Implementation in Javascript

Category : DATASTRUCTURE Author : Ayush Kush Date : Thu Jun 16 2016

Overview Binary search trees commonly knows as BST are a special type of trees which are sorted in nature. In binary search tree every node is larger than its left child and smaller than its right child. This feature makes it easy to search, insert and delete a node from binary search tree.  Algo //Check if root node is empty or not //    If yes then assign new node to root //    If not than iterate. Iterate method will check the node value to add from left and right child of...

Read Full

Walk through "The DIL wali Dilli"

Category : TRAVEL Author : Raman Shaily Date : Tue Jun 21 2016

The national capital is daily trending word. Some time for (dharna) some time for (harna). but apart from all this delhi had a defination earlier which has been somehow suprappsed by the recent incidents mostly political. Here are few facts on the positive part and "Dil wali Delhi" 1. Simlar to politicians today Delhi was favourite place for emperrors too. The proofs can be seen in around 174 monuments protected by ASI & 3 are the world heritage sites. These make Delhi as...

Read Full

MYSQL Between Clause

Category : MYSQL Author : Ankur Rastogi Date : Sat Apr 16 2016

Overview Between Clause is used to check where conditions between two values for a column. You can actually fetch, update, delete data by applying a condition between two values. Syntax Syntax for Between Clause is SELECT * FROM table_name WHERE column_name BETWEEN (Val1, Val2); Example Suppose we want to fetch list of hostels which have max_capacity between 1000 to 3000 students. SELECT * FROM hostel_list where max_capacity BETWEEN 1000 and 3000;...

Read Full

SQL Select Into

Category : SQL Author : Ankur Rastogi Date : Sun Mar 27 2016

Overview SQL SELECT INTO query is used to select data from one table and to copy that selected data into new table. Either we can copy all the data or we can also select a subset of data from the existing table which satisfies the given condition. Largely it is used to take backup or to copy the existing rows, records from one table to another new table. we can also say that SQL SELECT INTO is used to create new table by copying data from existing table. Syntax Syntax for SQL...

Read Full

SQL RDBMS Concept

Category : SQL Author : Ankur Rastogi Date : Sun Mar 06 2016

RDBMS stands for Relational Database Management System. RDBMS data are stored in database tables, record and fields in structured manner. Each RDBMS table consists of table rows and each row consists of data in the form of fields. RDBMS is collection of data stored in table consisting of rows and columns. RDBMS also provides several operators to define, manipulate the data stored into the tables and indexes. Most RDBMS use SQL as a database query language. Edgar Codd is the one...

Read Full

MYSQL Insert Into Select

Category : MYSQL Author : Ankur Rastogi Date : Sat Jun 04 2016

Overview MYSQL INSERT INTO SELECT query is used to select data from one table and to copy that selected data into another existing table. Either we can copy all the data or we can also select a subset of data from the table which satisfies the given condition. Largely it is used to take backup or to copy the existing rows, records from one table to another existing table. we can also say that MYSQL INSERT INTO SELECT is used to create new table by copying data from existing table....

Read Full

SQL SUM Function

Category : SQL Author : Ankur Rastogi Date : Sun Mar 27 2016

Overview SQL SUM() function returns the aggregated summation of all the values for input column name. There are lot of real scenario application uses for SUM function like calculate total population of a state by finding sum of its city wise population. Other use can be to find out the total salary given by company by finding out the sum of all the employee's salary. Other use case can be suppose in one table you have list of purchased goods than you can use sql sum function...

Read Full

Linux and Unix SCP Command

Category : LINUX Author : Ankur Rastogi Date : Sun Apr 17 2016

Overview scp -- secure copy (remote file copy program) As the name suggests Linux SCP Command is used to securely transfer files from source machine to destination machine. Often we get requirements to transfer some file from remote server to our local machine or say we need to transfer some file from our local machine to our colleague's machine and here file can be a movie as well :D. In such cases we uses we use Linux SCP Command.  Syntax Syntax for Linux SCP Command is...

Read Full

MYSQL Alter Table

Category : MYSQL Author : Ankur Rastogi Date : Sat Jun 04 2016

Overview SQL Alter table is used to update the database table structure of an existing table. Alter table command can add, delete or modify any of the column in an exisitng table. Lot of time we get a requirement to either add a new column, delete an existing column or change the name, place, data type or data a column can hold, In all such requirement we can use SQL Alter statement. Syntax for SQL Alter statement for add, drop and modify a column is mentioned below in their...

Read Full

MYSQL Syntax

Category : MYSQL Author : Ankur Rastogi Date : Sat Apr 16 2016

MYSQL syntax or query follows a particular rules and regulation which are denoted as MYSQL Syntax. Every MYSQL query starts with standard operators and ends with the semicolon. Some of The Most Important MYSQL Commands CREATE DATABASE - creates a new database ALTER DATABASE - modifies a database CREATE TABLE - creates a new table ALTER TABLE - modifies a table DROP TABLE - deletes a table INSERT INTO - inserts new data into a database SELECT -...

Read Full

Stay ahead of crowd with some extra hard and smart work.

Category : THOUGHTS Author : Ankur Rastogi Date : Tue Jul 12 2016

You come to office, you work hard whole day and in middle of that you see everyone around you is also working hard. You feel good to see there are all hardworking and smart people around you. Then suddenly you get some goose bumps that how you will differentiate your self from them to get you next job? Does the situation looks familiar to you? if yes then you should read this. If not then you haven't realised this thing yet so you should read it even more carefully. If you want to...

Read Full

Humanity is still present, Girl saving rickshaw wala from rain

Category : THOUGHTS Author : Amit Gupta Date : Fri Nov 04 2016

( Image Source ) It is not something that you see often nowdays that some one is helping someone else but when you do your faith on humanity restores.  It was a rainy day I was going for my classes in a car. I was at red light when I saw a rickshaw coming from other side with a girl sitting at the back of rickshaw. Here in Delhi we have a covered roof in rickshaw so girl was not getting wet in rain. She was carrying an umbrella with which she was covering rickshaw wale bhaiya so...

Read Full

SQL COUNT Function

Category : SQL Author : Ankur Rastogi Date : Sun Mar 27 2016

SQL COUNT function is used to return the total number of rows present in any database table. Count function is mainly used where we want to fetch the total number of records in any of the given table. Syntax for SQL Count() Function is SELECT COUNT(column_name) FROM table_name WHERE [condition]; Let us take a deeper look at count function with the help of an example Consider table student_list which contains the list of students...

Read Full

SQL Unique Key

Category : SQL Author : Ankur Rastogi Date : Sun Mar 27 2016

Overview Unique Key is used to define uniqueness in data in any column of a table. Primary Key and Unique key both are used to maintain uniqueness in a table.  Despite of lot of same functionalities in primary and unique keys. There are lot of differences as well. Unique key can have null values where as primary key does not. There can be lot of unique keys in a table but only one primary key. A primary key by default has unique constraint in it. Syntax Create Table with Unique key...

Read Full

MYSQL COUNT Function

Category : MYSQL Author : Ankur Rastogi Date : Sat Jun 04 2016

MYSQL COUNT function is used to return the total number of rows present in any database table. Count function is mainly used where we want to fetch the total number of records in any of the given table. Syntax for MYSQL Count() Function is SELECT COUNT(column_name) FROM table_name WHERE [condition]; Let us take a deeper look at count function with the help of an example Consider table student_list which contains the list of students...

Read Full

Linux and Unix Shutdown Command

Category : LINUX Author : Ankur Rastogi Date : Sun Apr 17 2016

Command Overview Linux Shutdown command is used to bring the system down. According to linux manual which states as shutdown arranges for the system to be brought down in a safe way. All logged-in users are notified that the system is going down and, within the last five minutes of TIME, new logins are prevented. TIME may have different formats, the most common is simply the word 'now' which will bring the system down immediately. Other valid formats are +m, where m is the number...

Read Full

MYSQL Create Table

Category : MYSQL Author : Ankur Rastogi Date : Sat Apr 16 2016

Overview Table is where database store structured data. For creating a simple or you can say basic database table you need a unique table name in that database and need to define columns and their data types. CREATE TABLE command is used for this purpose. Syntax Syntax for creating a simple database table is CREATE TABLE table_name (column_one data_type, column_two data_type, column_three data_type, primary key(column_name)); Example Now let us create a...

Read Full

SQL Where Condition

Category : SQL Author : Ankur Rastogi Date : Fri Mar 18 2016

Overview Where condition is used to fetch data from the table on the basis of some conditions on some of the data columns. Syntax Syntax for using where clause is SELECT * FROM table_name WHERE (conditions); Example Let us have a deeper look on this with the help of an example Let us consider our hostel_list table which contains the list of hostels. +----+-------------------+-----------+----------+ | id | name | occupancy | capacity...

Read Full