Use Three Conditions in a Single MySQL Query to Fetch Student Records

AmitDiwan
Updated on 03-Oct-2019 06:07:31

288 Views

Let us first create a table −mysql> create table DemoTable (    StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    StudentName varchar(50),    StudentAge int ); Query OK, 0 rows affected (0.72 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentName, StudentAge) values('Chris', 21); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable(StudentName, StudentAge) values('David', 23); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable(StudentName, StudentAge) values('Bob', 22); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable(StudentName, StudentAge) values('Carol', 21); Query OK, 1 row affected (0.30 sec)Display all records from ... Read More

Count Unique Phone Numbers in MySQL Bigint Column

AmitDiwan
Updated on 03-Oct-2019 06:04:24

739 Views

For this, you can use COUNT() along with DISTINCT. The COUNT() method is to count the records. However, the DISTINCT returns distinct records, whereas COUNT() method counts those unique records. Let us first create a table −mysql> create table DemoTable (    PhoneNumber bigint ); Query OK, 0 rows affected (1.29 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(8567789898); Query OK, 1 row affected (0.94 sec) mysql> insert into DemoTable values(8567789898); Query OK, 1 row affected (0.34 sec) mysql> insert into DemoTable values(9876564534); Query OK, 1 row affected (0.43 sec) mysql> insert into DemoTable ... Read More

Only Display Row with Highest ID in MySQL

AmitDiwan
Updated on 03-Oct-2019 06:02:55

189 Views

To order, use the ORDER BY DESC clause. With that, since we want a single ID, which should be the highest, use LIMIT 1. This will fetch the row with highest ID. Let us first create a table −mysql> create table DemoTable (    Id int,    FirstName varchar(50) ); Query OK, 0 rows affected (0.83 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(100, 'Chris'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable values(110, 'Robert'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values(120, 'Mike'); Query OK, 1 ... Read More

Get File's Permission Mask Using Python

Rajendra Dharmkar
Updated on 03-Oct-2019 05:57:13

311 Views

To get stat of a file, method stat() from the os module can be used. It performs a stat system call on the given path. For example,import os st = os.stat("file.dat")This function takes the name of a file, and returns a 10-member tuple with the following contents:(mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime)The mode variable gives you the information about file permissions. You can get it by st[0]. 

HTML5 Semantics

AmitDiwan
Updated on 01-Oct-2019 11:58:14

869 Views

The HTML5 Semantics refers to the semantic tags that provide meaning to an HTML page. In HTML5 the tags are divided into two categories - semantic and non-semantic. HTML5 brings several new semantic tags to the HTML.Some HTML5 Semantic tags are −TagsExplanationfigureIt specifies an image with different formats.articleIt specifies an independent self-containing article.navIt specifies a container for navigation links.asideIt specifies a tag for content aside from main content (like a sidebar).sectionIt represents a section in a document.detailsIt specifies a tag for additional details.headerIt specifies a header for a section or for a document.footerIt specifies a footer for a section or ... Read More

HTML Form Action Attribute

AmitDiwan
Updated on 01-Oct-2019 11:55:02

2K+ Views

The HTML form action attribute defines where to send the form data when a form is submitted in an HTML document.SyntaxFollowing is the syntax −Let us see an example of HTML Form action Attribute −Example Live Demo    body {       color: #000;       height: 100vh;       background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%) no-repeat;       text-align: center;    }    input {       width: 315px;       display: block;       margin: 1rem auto;       border: 2px solid #fff;       padding: 8px;   ... Read More

HTML Window SessionStorage Property

AmitDiwan
Updated on 01-Oct-2019 11:51:40

321 Views

The HTML Window sessionStorage property allow us to store key/value pairs data in a web browser only for one session that means the data is deleted when the browser tab is closed.SyntaxFollowing is the syntax −window.sessionStorageLet us see an example of HTML Window sessionStorage Property −Example Live Demo    body {       color: #000;       height: 100vh;       background-color: #8BC6EC;       background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat;       text-align: center;    }    .btn {       background: #db133a;       border: none;       ... Read More

HTML window.self Property

AmitDiwan
Updated on 01-Oct-2019 11:48:09

167 Views

The HTML Window self property returns the current window of the browser.SyntaxFollowing is the syntax −window.selfLet us see an example of HTML Window self Property −Example Live Demo    body {       color: #000;       height: 100vh;       background-color: #8BC6EC;       background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat;       text-align: center;    }    .btn {       background: #db133a;       border: none;       height: 2rem;       border-radius: 2px;       width: 30%;       display: block;       ... Read More

HTML window.top Property

AmitDiwan
Updated on 01-Oct-2019 11:45:43

346 Views

The HTML Window top property returns the topmost browser window of the current window.SyntaxFollowing is the syntax −window.topLet us see an example of HTML Window top Property −Example Live Demo    body {       color: #000;       height: 100vh;       background-color: #8BC6EC;       background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat;       text-align: center;    }    .btn {       background: #db133a;       border: none;       height: 2rem;       border-radius: 2px;       width: 30%;       display: block;   ... Read More

HTML window.resizeTo() Method

AmitDiwan
Updated on 01-Oct-2019 11:41:39

364 Views

The HTML Window resizeTo() method resize a window relative to its current size by the specified values.SyntaxFollowing is the syntax −window.resizeTo(w, h)Here w and h define the value of resizing the window width and height in pixels respectively.Let us see an example of HTML Window resizeTo() Method −Example Live Demo    body {       color: #000;       height: 100vh;       background-color: #8BC6EC;       background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat;       text-align: center;    }    .btn {       background: #db133a;       border: none;   ... Read More

Advertisements