Skip to content
Advertisement

Tag: sql

How do I enforce data integrity rules in my database?

I’m designing this collection of classes and abstract (MustInherit) classes… This is the database table where I’m going to store all this… As far as the Microsoft SQL Server database knows, those are all nullable (“Allow Nulls”) columns. But really, that depends on the class stored there: LinkNode, HtmlPageNode, or CodePageNode. Rules might look like this… How do I enforce

Keep pagination repeatable if change operations are performed

If one wants to paginate results from a data source that supports pagination we have to go to a process of: defining the page size – that is the number of results to show per page; fetch each page requested by the user using an offset = page number (0 based) * page size show the results of the fetched

Difference between BYTE and CHAR in column datatypes

In Oracle, what is the difference between : and Answer Let us assume the database character set is UTF-8, which is the recommended setting in recent versions of Oracle. In this case, some characters take more than 1 byte to store in the database. If you define the field as VARCHAR2(11 BYTE), Oracle can use up to 11 bytes for

What are the use cases for selecting CHAR over VARCHAR in SQL?

I realize that CHAR is recommended if all my values are fixed-width. But, so what? Why not just pick VARCHAR for all text fields just to be safe. Answer The general rule is to pick CHAR if all rows will have close to the same length. Pick VARCHAR (or NVARCHAR) when the length varies significantly. CHAR may also be a

How can you handle an IN sub-query with LINQ to SQL?

I’m a bit stuck on this. Basically I want to do something like the following SQL query in LINQ to SQL: Any help would be gratefully received. Answer Have a look at this article. Basically, if you want to get the equivalent of IN, you need to construct an inner query first, and then use the Contains() method. Here’s my

Advertisement