Posts

Showing posts from September, 2020

Sorting Multiple Columns

Image
Sorting Multiple Columns ORDER BY can sort retrieved data by multiple columns. When using ORDER BY with more than one column, separate the list of columns to follow ORDER BY with commas. Here is the customers table, showing the following records: To order by LastName and Age: SELECT * FROM customers ORDER BY LastName, Age; This ORDER BY statement returns the following result: As we have two Smiths, they will be ordered by the Age column in ascending order. The ORDER BY command starts ordering in the same sequence as the columns. It will order by the first column listed, then by the second, and so on.

Fully Qualified Names

Image
Fully Qualified Names In SQL, you can provide the table name prior to the column name, by separating them with a dot. The following statements are equivalent: SELECT City FROM customers; SELECT customers.City FROM customers; The term for the above-mentioned syntax is called the "fully qualified name" of that column. This form of writing is especially useful when working with multiple tables that may share the same column names. Order By ORDER BY is used with SELECT to sort the returned data. The following example sorts our customers table by the FirstName column. SELECT * FROM customers ORDER BY FirstName; Result:

The LIMIT Keyword

Image
The LIMIT Keyword By default, all results that satisfy the conditions specified in the SQL statement are returned. However, sometimes we need to retrieve just a subset of records. In MySQL, this is accomplished by using the LIMIT keyword. The syntax for LIMIT is as follows: SELECT column list FROM table_name LIMIT [number of records]; For example, we can retrieve the first five records from the customers table. SELECT ID, FirstName, LastName, City FROM customers LIMIT 5; This would produce the following result: The LIMIT Keyword You can also pick up a set of records from a particular offset. In the following example, we pick up four records, starting from the third position: SELECT ID, FirstName, LastName, City FROM customers LIMIT 3, 4; This would produce the following result: The reason that it produces results starting from ID number four, and not three, is that MySQL starts counting from zero, meaning that the offset of the first row is 0, not 1

The DISTINCT Keyword

Image
The DISTINCT Keyword In situations in which you have multiple duplicate records in a table, it might make more sense to return only unique records, instead of fetching the duplicates. The SQL DISTINCT keyword is used in conjunction with SELECT to eliminate all duplicate records and return only unique ones. The basic syntax of DISTINCT is as follows: SELECT DISTINCT column_name1, column_name2 FROM table_name; See the customers table below: Note that there are duplicate City names. The following SQL statement selects only distinct values from the City column: SELECT DISTINCT City FROM customers; This would produce the following result. Duplicate entries have been removed. The DISTINCT keyword only fetches the unique values.

Selecting Multiple Columns

Image
As previously mentioned, the SQL SELECT statement retrieves records from tables in your SQL database. You can select multiple table columns at once. Just list the column names, separated by commas: SELECT FirstName, LastName, City FROM customers; Selecting All Columns To retrieve all of the information contained in your table, place an asterisk (*) sign after the SELECT command, rather than typing in each column names separately. The following SQL statement selects all of the columns in the customers table: SELECT * FROM customers;

SELECT Statement

SELECT Statement The SELECT statement is used to select data from a database. The result is stored in a result table, which is called the result-set. A query may retrieve information from selected columns or from all columns in the table. To create a simple SELECT statement, specify the name(s) of the column(s) you need from the table. Syntax of the SQL SELECT Statement: SELECT column_list FROM table_name - column_list includes one or more columns from which data is retrieved - table-name is the name of the table from which the information is retrieved Below is the data from our customers table: The following SQL statement selects the FirstName from the customers table: SELECT FirstName FROM customers

Basic SQL Commands

Image
Basic SQL Commands The SQL SHOW statement displays information contained in the database and its tables. This helpful tool lets you keep track of your database contents and remind yourself about the structure of your tables. For example, the SHOW DATABASES command lists the databases managed by the server. SHOW DATABASES Throughout the tutorial we will be using the MySQL engine and the PHPMyAdmin tool to run SQL queries. Basic SQL Commands The SHOW TABLES command is used to display all of the tables in the currently selected MySQL database. Basic SQL Commands SHOW COLUMNS displays information about the columns in a given table. The following example displays the columns in our customers table:. SHOW COLUMNS FROM customers. SHOW COLUMNS displays the following values for each table column:. Field: column name. Type: column data type. Key: indicates whether the column is indexed. Default: default value assigned to the column. Extra: may contain any additional in...

What is SQL?

What is SQL? Once you understand what a database is, understanding SQL is easy. SQL stands for Structured Query Language. SQL is used to access and manipulate a database. MySQL is a program that understands SQL. SQL can: - insert, update, or delete records in a database. - create new databases, table, stored procedures, views. - retrieve data from a database, etc.

What is Word Wrapping and how to use in CSS3?

Fonts and Text Effects What is Word Wrapping and how to use in CSS3? Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. word-wrap:break-word; ...normal; ....inherit....initial

Text shadow

Shadow Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod h1{text-shadow: 5px 5px 8px blue;}

How to Add font and Text Effects in CSS3?

Fonts and Text Effects How to Add font and Text Effects in CSS3? , web font are not pre installed on the user's computer Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. @import url('https://fonts.googleapis.com/css2?family=Miltonian+Tattoo&display=swap'); CSS rules to specify families font-family: 'Miltonian Tattoo', cursive;

How to use Structural Pseudo class in CSS3

Pseudo Classes CSS3 How to use Structural Pseudo class in CSS3 nth-child this is a first child (first-child) this is a second child even this is a third child odd this is a fourth child this is a fifth child this is a six child this is a seven child (last-child) in nth-child( number) can use in nth-child( 3in +1 ) can also use

What is Negation Pseudo Class in and where to use in CSS3?

Selectors and Pseudo Classes CSS3 What is Negation Pseudo Class in and where to use in CSS3? Childs class is here i am 1st paragraph WITH same class i am 1st paragraph WITH same class i am 1st paragraph WITH diffrent class i am 1st paragraph WITH same class

What is UI Elements-Pseudo Class and how to use in CSS3 ?

CSS What is UI Elements-Pseudo Class and how to use in CSS3? The UI (stands for User Interface) element states pseudo-classes enables you to specify the appearance of UI elements, such as buttons and check boxes. Enabled Disabled Checked user form User name: Password: E-mail: About link hower color       hower me then color will we changed

What is target Pseudo Class in how to use in CSS3?

CSS What is target Pseudo Class in how to use in CSS3? User name: Password: E-mail: Hello world click here