To find and return the records with the odd or even values, the most simple way is to check the remainder when we divide the column value by 2. When the remainder is 0, that’s an even number, otherwise, that’s an odd number.
Here is the syntax:
In PostgreSQL, My SQL, and Oracle, we use MOD function to check the remainder.
To find rows where a specified column has even values:
SELECT *
FROM table_name
WHERE mod(column_name,2) = 0;
To find rows where a specified column has odd values:
SELECT *
FROM table_name
WHERE mod(column_name,2) <> 0;
In MS SQL Server, there is no MOD function and you can use %.
To find rows where a specified column has even values:
SELECT *
FROM table_name
where column_name % 2 = 0;
To find rows where a specified column has odd values:
SELECT *
FROM table_name
where column_name % 2 <> 0;
Example
We have table dept_manager in MySQL:
emp_id
dept_id
from_date
to_date
110022
d001
1985-01-01
1991-10-01
110039
d001
1991-10-01
9999-01-01
110085
d002
1985-01-01
1989-12-17
110114
d002
1989-12-17
9999-01-01
110183
d003
1985-01-01
1992-03-21
110228
d003
1992-03-21
9999-01-01
110303
d004
1985-01-01
1988-09-09
110344
d004
1988-09-09
1992-08-02
110386
d004
1992-08-02
1996-08-30
110420
d004
1996-08-30
9999-01-01
110511
d005
1985-01-01
1992-04-25
110567
d005
1992-04-25
9999-01-01
110725
d006
1985-01-01
1989-05-06
110765
d006
1989-05-06
1991-09-12
110800
d006
1991-09-12
1994-06-28
110854
d006
1994-06-28
9999-01-01
111035
d007
1985-01-01
1991-03-07
111133
d007
1991-03-07
9999-01-01
111400
d008
1985-01-01
1991-04-08
111534
d008
1991-04-08
9999-01-01
111692
d009
1985-01-01
1988-10-17
111784
d009
1988-10-17
1992-09-08
111877
d009
1992-09-08
1996-01-03
111939
d009
1996-01-03
9999-01-01
Now find all the rows having emp_id as even number:
SELECT *
FROM dept_manager
WHERE MOD(emp_id, 2) = 0;
The results is:
emp_id
dept_id
from_date
to_date
110022
d001
1985-01-01
1991-10-01
110114
d002
1989-12-17
9999-01-01
110228
d003
1992-03-21
9999-01-01
110344
d004
1988-09-09
1992-08-02
110386
d004
1992-08-02
1996-08-30
110420
d004
1996-08-30
9999-01-01
110800
d006
1991-09-12
1994-06-28
110854
d006
1994-06-28
9999-01-01
111400
d008
1985-01-01
1991-04-08
111534
d008
1991-04-08
9999-01-01
111692
d009
1985-01-01
1988-10-17
111784
d009
1988-10-17
1992-09-08
Need a good GUI tool for databases? TablePlus provides a native client that allows you to access and
Multiple TXT DNS records are perfectly acceptable. In fact, I think one of my domains has about 6 of them. If you append it to the end of another TXT record, it is likely to stop that one performing it's correct function.
Solved it by creating App password. You must got to Google account. Security tab, active 2 Step Verification. After this new option under "Signing in to Google" the "App passwords" option will be actived. Just create one app password and use as password to authenticate
Here is a more precise answer with all the main steps. I hope it will help other people.
Be sure that you have turn on two steps verification and click on "App password"
After select email and the corresponding device
It will generate a password that will look like this; it is this password that you have to use in your python script.
This password will appear here; in this place, you will have the option to erase it (so it will be no longer be useful to connect to your email account).
Yes, Gatsby by default creates a page for every js file in src/pages. Try moving your template to some other folder like src/templates and adjust the value of component in createPage() accordingly.
You can make a GraphQL HTTP request in literally any programming language, as long as you can set the above 4 parts correctly. So let’s convert that curl request into some JavaScript code with fetch, the new standard for getting HTTP results with promises. This will work in modern browsers with no libraries, but will require a polyfill in Node and some browsers. Let’s check out the code:
require('isomorphic-fetch');fetch('http://localhost:4000',{
method:'POST',
headers:{'Content-Type':'application/json'},
body:JSON.stringify({ query:`
query {
todos {
edges {
node {
completed
id
text
}
}
}
}`}),}).then(res=> res.json()).then(res=> console.log(res.data));
If you run this code Chrome’s DevTools, you’ll notice that the following output is printed to the console.
Neat, right? As you can see, the way we request GraphQL data using Fetch is pretty similar to the request we constructed with curl, but there are a few things here that would become pretty repetitive if we had to type them out every time. Not only that, but to effectively work with GraphQL data in most applications, you’ll likely want to cache it, display the data somehow, and re-render your view when it changes.
That sounds like something that a GraphQL client can help us with.