SQL Queries Practice & Solutions

Solve following queries using aggregate functions for the table.

Table: sales (orderID OrderDate OrderPrice OrderQuantity CustomerName)

0

1.Count how many orders have made a customer with customer name of Smith.

1

2.Find the number of unique customers that have ordered from the store.

2

3.Find out total no. of items ordered by all the customers.

3

4.Find out the average number of items per order.

4

5.Find out the average order quantity for all orders with order price greater than 200.

5

6.Find out what was the minimum price paid for any of the orders.

6

7.Find out the highest order price from the given sales table.

7

8.List out unique customers name only from the table.

8

9.List out the name of the customers who have given an order in the month of DECEMBER.

9

10.Find out the total amount of money spent for each of the customers.

10

11. Select all unique customers, who have spent more than 1200 in the store.

11


Now I had updated my table and inserted more values in it.

Capture


12.Select all the customers that have ordered more than 5 items in total from all their orders.

12

13.Select all customers who have spent more than 1000, after 10/01/2005.

13

14.Select orders in increasing order of order price.

14

15 Select orders in decreasing order of order price.

15


Thank You, Like, Share, Subscribe.

Important Linux Commands

Some of the important Linux commands are here to get pace up with Linux.

useradd

Basic Syntax Of Command.

useradd [options] username

  1. To add new user on Linux.
  2. Create a user with different home directory.
  3. Create a user with different user id.
  4. Create a user with different specific group id.
  5. Add a user to multiple groups.
  6. Add user login shell.

batch

Basic Syntax Of Command.

After typing the batch command, the at> prompt is displayed.

at

Basic Syntax Of Command.

at 9:30 PM Tue

  1. at executes commands at a specified time.
  2. atrm deletes jobs, identified by their job number.
  3. atq lists the user’s pending jobs, unless the user is the superuser in that case, everybody’s jobs are listed. The format of the output lines job numberdatehouryearqueue, and username.

 

banner

Basic Syntax Of Command.

 $ banner 'Hello!'
 Output Line is as:-

 #     #                                   ###
 #     #  ######  #       #        ####    ###
 #     #  #       #       #       #    #   ###
 #######  #####   #       #       #    #    #
 #     #  #       #       #       #    #
 #     #  #       #       #       #    #   ###
 #     #  ######  ######  ######   ####    ###

cat

cat stands for “catenate.”

Basic syntax of cat is :-

cat mytext.txt

It reads data from files, and outputs their contents. It is the simplest way to display the contents of a file at the command line.

  1. To Copy A Text File.
  2. Append A Text File’s Contents To Another Text File.
  3. Incorporating Standard Input Into cat Output.

cd

For change directory.

Basic Syntax:

$ cd /usr/local
:/usr/local$

  1. To change current directory to local.
  2. Move one directory to back.
  3. Move to users home directory.
  4. The cd command can be used to change into a sub directory, move back into the parent directory, move all the way back to the root directory or move to any given directory.

chmod

chmod ( Change Mode ) is used to change the permissions of files or directories.

Basic Syntax:

chmod options permission file name


chown

To change the owner of group file.

Basic Syntax:

chown [OPTION]... [OWNER][:[GROUP]] FILE...

clear

To clear the terminal screen.

Basic Syntax:

clear


cp

To copy a file and directory.

Basic Syntax:

cp [OPTION]... [-T] SOURCE DEST
cp [OPTION]... SOURCE... DIRECTORY
cp [OPTION]... -t DIRECTORY SOURCE...

cpio

copies files to and from archives.

cpio copies files from one directory tree to another.

Basic Syntax:

cpio {-o|--create} [-0acvABLV] [-C bytes] [-H format] [-M message] 
     [-O [[user@]host:]archive] [-F [[user@]host:]archive] 
     [--file=[[user@]host:]archive] [--format=format] 
     [--message=message][--null] [--reset-access-time] [--verbose] [--dot] 
     [--append] [--block-size=blocks] [--dereference] [--io-size=bytes] 
     [--rsh-command=command] [--help] [--version] < name-list [> archive]

cut

Cut command in unix is used to select sections of text from each line of files.

Basic Syntax:

$ cut -c n [filename(s)]


dc

Desk Calculator.

The desk calculator works with post-fix notation, rather like many HP Calculators. Basic arithmetic uses the standard + – / * symbols but entered after the digits.

Basic Syntax:

dc


dd

Data Duplicator.

To copy and converting data.

dd if=<source file name> of=<target file name> [Options]

 

For More Commands Watch Videos. 

Part 1

Part 2


 

100 Most Important Abbreviations Of Information & Communication Technology ( ICT )

100 Most Important Abbreviations Of  Information & Communication Technology, ICT.

To Get FREE Pdf Click Here Or Download From -> GENERAL Abbreviations 

 

                      Watch Full Lecture On Youtube:-

 

Nokia Is All Set To Launch Its First Ever Android Smartphone In India.

Nokia is launching its first ever Android smartphone in India in Mid June. According to MWC report, Nokia is going to launch 3 avatars of Android phones Nokia3, Nokia5 & Nokia6 in the market soon.

For complete details about price, features and its specifications, click on the image below or click here to watch complete details about the products.

1.png

Click here to watch the complete details.

Subscribe Us on our YouTube channel for more updates.

Like, Share, Comment, Subscribe 

 

OSI Model (Open System Interconnection) Networking Model

OSI Model Stands For Open System Interconnection Model Which Is Consists Of Seven Layers.

  1. Physical layer
  2. Data Link Layer
  3. Network Layer
  4. Transport Layer
  5. Session Layer
  6. Presentation layer
  7. Application Layer

All Layers Have Their Own Functions And Responsibilities. For Getting Into Details Watch The Video Given In Link Below.

Complete OSI Model Watch Here.

 

For Getting Complete Lecture In PDF Format. Comment OSI Model On Video.

Components Of Data Communication

Major Components Of Data Communication in Networking

There are five major components of the data communication in networking.

which are as follows:-

  • Message

  • Sender

  • Receiver

  • Medium

  • Protocol

 

  1. Message :- Actual data between the two devices or exchanged between Sender and Receiver.
  2. Sender :- Source of the data message.
  3. Receiver :- End unit of data communication.
  4. Medium :- Path chosen for the sending data over different mediums. like Optic Fiber, Coaxial Cables etc.
  5. Protocol :- Set of rules for the communication which is followed by sending message over different mediums.