Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Doubt in select statement

Featured Replies

I have table with some column fields are name studentid and status(yes/no)

If i want to find out those records which have same studentid but different status?

What should i do?

select * from table where status = 1 and studentid in (select studentid from table where status = 0)

 

 

... status(yes/no)

...

 

There is no need for a string datatype for your status field (unless you are using Access and the boolean datatype which stores "Yes" or "No" in a string format)

For MySQL databases you can use TINYINT(1) to create a boolean type. The field could contain two values then: 0 and 1. (If you allow null you would technically have 3 values)

This would optimize your select statement a lot as it takes time for the database to scan string values.

 

 

There is no need for a string datatype for your status field (unless you are using Access and the boolean datatype which stores "Yes" or "No" in a string format)

For MySQL databases you can use TINYINT(1) to create a boolean type. The field could contain two values then: 0 and 1. (If you allow null you would technically have 3 values)

This would optimize your select statement a lot as it takes time for the database to scan string values.

I actually think a more appropriate datatype to use in this case would be ENUM

I actually think a more appropriate datatype to use in this case would be ENUM

Good point. That would keep your database slim and save you from converting the values to strings programmatically

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.